Delete duplicated row in a matrix

1 ビュー (過去 30 日間)
Marco
Marco 2013 年 6 月 25 日
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]

採用された回答

Tom
Tom 2013 年 6 月 25 日
I = ~ismember(a(:,1:2),b(:,1:2),'rows');
a = a(I,:)

その他の回答 (0 件)

カテゴリ

Find more on Creating and Concatenating Matrices in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by