Reputation: 2791
I have the following array:
a = magic(12);
a = a(:,1);
It's a list of these twelve numbers:
144
13
25
108
96
61
73
60
48
109
121
12
Now if I want to 'filter out' the values of 25, 61 and 109, I could write something like this:
m = (a == 25) | (a == 61) | (a == 109)
However, is there a way to write that more easily? Something like:
m = a IN(25, 61, 109)
Best.
Upvotes: 0
Views: 176