MATLAB: Find Index Positions of a Small Array values in a Global Array

find index array positions

Hi guys,
I have a "global" array: Global = [1; 4; 6; 9; 13; 17; 26; 33; 47].
And a "small" array: Small = [6; 26; 47]
How can I find the positions of the "small" array values into the "Global" array? The result would be: Result = [3 7 9]
Thanks! Nicolas

Best Answer

G = [1; 4; 6; 9; 13; 17; 26; 33; 47];
S= [6; 26; 47];
find(ismember(G,S))
ans =
3
7
9