Reputation: 29
I want to compare two columns matrix : such as
a=[1;2;2;3;4;4;5;6] b=[2;4;8]
and get the output like
d=[0;1;1;0;1;1;0;0]
which is same number of rows of matrix a.
a
Upvotes: 2
Views: 409
Reputation: 4115
ismember is exact what you need. Try:
ismember
c=ismember(a,b)
Upvotes: 5