Remove duplicate rows from matrix

13 ビュー (過去 30 日間)
MC
MC 2017 年 5 月 14 日
編集済み: Stephen23 2022 年 3 月 6 日
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
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
Stephen23 2022 年 3 月 6 日

サインインしてコメントする。

採用された回答

Stephen23
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 件のコメント
LO
LO 2019 年 4 月 12 日
how can I keep all values of each row ?
Paween Pongsomboon
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 ExchangeLogical についてさらに検索

タグ

製品

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by