MATLAB Answers

Delete duplicated row in a matrix

조회 수: 1(최근 30일)
Marco
Marco 25 Jun 2013
I have two matrix like this:
a=[1 2 3; 2 1 3; 2 2 4;2 3 6;2 4 5;3 7 7;3 6 6]
b=[1 2 5;2 2 5;2 3 6;2 4 7;3 6 7]
I want delete, without change order, the duplicated rows without consider third column, but only respect column 1 and 2.
So the output would be: [2 1 3; 3 7 7]

  댓글 수: 0

로그인 to comment.

채택된 답변

Tom
Tom 25 Jun 2013
I = ~ismember(a(:,1:2),b(:,1:2),'rows');
a = a(I,:)

  댓글 수: 0

로그인 to comment.

More Answers (0)

이 질문에 답변하려면 로그인을(를) 수행하십시오.


Translated by