removing specifics elements from a matrix

1 次查看(过去 30 天)
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 CenterFile Exchange 中查找有关 Matrix Indexing 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by