I have a simple question.
lets say we have two arrays:
data = [1 1 2 2 2 2 3 3 3 4 4 4 4 4 5 5 5 5 6 6 6];
A = [1 3 6];
I want to have indices of values from data which are equal to any value from A.
i.e. answer for that will be: 1, 2, 7, 8, 9, 19, 20, 21
How to do it without using for loop and scanning each value from A one by one..?
Thanks!
Art.
This will do exactly that:
the function
ismemberwill find all elements indatathat are inA. The second output ofismembercould also be useful:where the
1,2and3refer to the index intoA.