Extracting rows with specific condition in MATLAB
2 ビュー (過去 30 日間)
古いコメントを表示
Hi, i have a problem. I got two matric dimension mx3 and nx3. For example:
A=[2,2345,1; 2,2344,0; 4, 2345,56 ; 4,2000,1; 2,2346,22; 4,2111,1]
B=[2,2346,22; 2,2344,0; 4, 2314,56 ; 4,2111,1]
Ok, here are two matrix. What I want to do is to look first and second row and find same elements and on basis of this extract matrix C which will contain all rows that dont fit condition.
Example:
2,2346 in A fit 2,2346 from B
2,2345 in A and its not in B. That means the whole row goes to C 2,2345,1
And so on...I tried to this with setxor, but problem is that i look just second column.. Thank you for your help.
0 件のコメント
採用された回答
Azzi Abdelmalek
2013 年 3 月 18 日
編集済み: Azzi Abdelmalek
2013 年 3 月 18 日
A=[2,2345,1; 2,2344,0; 4, 2345,56 ; 4,2000,1; 2,2346,22; 4,2111,1]
B=[2,2346,22; 2,2344,0; 4, 2314,56 ; 4,2111,1]
C=A(~ismember(A(:,1:2),B(:,1:2),'rows'),:)
0 件のコメント
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Logical についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!