MATLAB: Searching different elements from array.

arraysearch

Hi,
I have an array, and I want a new array with matches from another array.
Like,
array=[12 3 4 8 9 3 3 4 1]
search=[4 9 3]; % numbers that i want to match...
new_array=matches(array, search); % matches is a function or an script...
new_array would be [0 0 1 0 0 1 1 0 0].
There is a function for it?
Andre

Best Answer

array=[12 3 4 8 9 3 3 4 1]
search=[4 9 3];
ismember(array,search)