Remove duplicate rows from matrix
조회 수: 7 (최근 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!