How to remove identical pair of data from a matrix in MATLAB?

1 回表示 (過去 30 日間)
Abhiram B R
Abhiram B R 2021 年 5 月 11 日
コメント済み: Jonas 2021 年 5 月 11 日
I have a Nx2 matrix with identical pairs. Something like this:
b_data = [ 1 2; 3 4; 7 10; 2 1; 10 7; 11 12];
i consider 1 2, 2 1 as identical
I need to make this
b_data = [1 2; 3 4;7 10; 11 12];
Is there any command for doing so?

採用された回答

Jonas
Jonas 2021 年 5 月 11 日
use something like
unique(sort([1 2; 2 1; 3 5],2),'rows')
  4 件のコメント
Rik
Rik 2021 年 5 月 11 日
Ah, sorry, I must have read it too quickly. Have an upvote as an apology.
Jonas
Jonas 2021 年 5 月 11 日
no problem, i also often read faster than i can think ;)

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeShifting and Sorting Matrices についてさらに検索

製品


リリース

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by