Remove duplicate rows from matrix
54 次查看(过去 30 天)
显示 更早的评论
Hello
I have a 2xN matrix where each column represent the x and y coordinates of a 2D point. I need to remove any duplicate point from this matrix, any suggestions?
Best regards MC
4 个评论
Garvit Amipara
2022-3-6
It would be very nice of you, if you could change the title of this question, it misleads others who are actually looking for the answers related to 'vector'. Thank you(:
采纳的回答
Stephen23
2017-5-14
编辑:Stephen23
2017-5-14
It is trivial to use unique to get only the unique rows of matrix. Because your matrix is arranged 2xN, simply transpose before and after:
unique(M.','rows').'
5 个评论
Paween Pongsomboon
2022-2-18
I don't know if you still alive, stephen. I wish I could hug you now!
Thx for the super solution
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Logical 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!