omit rows from matrix
1 view (last 30 days)
Show older comments
A=[1,2;1,3;1,4;1,5;2,4;2,3;2,5]
B=[2,4]
I want to omit B from matrix A
answer
A=[1,2;1,3;1,4;1,5;2,3;2,5]
0 Comments
Accepted Answer
madhan ravi
on 24 Nov 2018
Edited: madhan ravi
on 24 Nov 2018
>> A=[1,2;1,3;1,4;1,5;2,4;2,3;2,5];
B=[2,4];
idx=ismember(A,B,'rows');
A = A(~idx,:)
A =
1 2
1 3
1 4
1 5
2 3
2 5
>>
0 Comments
More Answers (0)
See Also
Categories
Find more on Matrix Indexing 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!