omit rows from matrix

1 view (last 30 days)
NA
NA 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]
I want to omit B from matrix A
answer
A=[1,2;1,3;1,4;1,5;2,3;2,5]

Accepted Answer

madhan ravi
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
>>

More Answers (0)

Tags

Community Treasure Hunt

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

Start Hunting!