フィルターのクリア

Remove the duplicated vector in the array

2 ビュー (過去 30 日間)
Sounghwan Hwang
Sounghwan Hwang 2022 年 6 月 13 日
コメント済み: Voss 2022 年 6 月 13 日
Hi. I'm struggling with how to make my code.
Here is the thing. I want to get a new matrix A such that all duplicated vectors are removed. Here is my matrix A and a new matrix A that I want to get:
A = [1 3; 1 4; 1 3; 1 4; 2 3; 3 4; 3 4; 3 5; 4 5]
new A = [1 3; 1 4; 2 3; 3 4; 3 5; 4 5].
How to write the code to get new A...? I'm trying to make it as a function, however, I don't have clear ideas...
I need some help! Thank you so much!!

採用された回答

Voss
Voss 2022 年 6 月 13 日
編集済み: Voss 2022 年 6 月 13 日
A = [1 3; 1 4; 1 3; 1 4; 2 3; 3 4; 3 4; 3 5; 4 5];
new_A = unique(A,'rows')
new_A = 6×2
1 3 1 4 2 3 3 4 3 5 4 5
  2 件のコメント
Sounghwan Hwang
Sounghwan Hwang 2022 年 6 月 13 日
Awesome.... thank you so much. I didn't know that there is a unique function in the Matlab. Really appreciated!!
Voss
Voss 2022 年 6 月 13 日
You're welcome!

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMatrix Indexing についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by