removing specifics elements from a matrix

1 回表示 (過去 30 日間)
giuseppe insignito
giuseppe insignito 2020 年 11 月 26 日
コメント済み: Stephen23 2020 年 11 月 26 日
I have the following matrix
acomb_w =
1 1
2 1
3 1
4 1
1 2
2 2
3 2
4 2
1 3
2 3
3 3
4 3
1 4
2 4
3 4
4 4
I need to get rid, automatically, of all the rows with doubles, so that:
acomb_w =
2 1
3 1
4 1
1 2
3 2
4 2
1 3
2 3
4 3
1 4
2 4
3 4
Can anyone help me?
Thanks!

採用された回答

Stephen23
Stephen23 2020 年 11 月 26 日
編集済み: Stephen23 2020 年 11 月 26 日
acomb_w = [...
1 1
2 1
3 1
4 1
1 2
2 2
3 2
4 2
1 3
2 3
3 3
4 3
1 4
2 4
3 4
4 4];
acomb_w(~diff(acomb_w,1,2),:) = []
acomb_w = 12×2
2 1 3 1 4 1 1 2 3 2 4 2 1 3 2 3 4 3 1 4
... some rows truncated here
  2 件のコメント
giuseppe insignito
giuseppe insignito 2020 年 11 月 26 日
It worked! Even if I don't get what happen exactly...
Stephen23
Stephen23 2020 年 11 月 26 日
@giuseppe insignito : I'm glad. Please remember to accept my answer!

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

その他の回答 (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