I have a column vector:
A = [1; 2; 3; 4; 4; 5; 5; 7];
I wish to exclude the elements of A
that are in a second matrix B
:
B = [4; 5]
The final result should be:
A = [1; 2; 3; 7]
I am pretty sure using MATLAB elegant syntaxing, this be accomplished without writing a for
loop, but not sure how?
I would use Afilt=A(~ismember(A,B));
. This will return all elements of A
which are not in B
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With