From: Judy on
Thank you for all your inputs! :)
From: Jan Simon on
Dear Judy!

> I am looking for any 5's and want to see if there is a quick way to check if there is a 5 in a large array -- i.e. a=zeros(100,100); a(23,64)=5;

While ISMEMBER is not really fast, Matt's method is efficient:
any(a(:) == 5)
If you are working on 100x100 arrays, the efficiency should be enough. But if you process thousands of arrays with 100MB, a C-Mex can be dramatically faster: a(:)==5 compares all elements of the array, but if the first element is 5 the processing can be stopped early!

Kind regards, Jan
From: Jan Simon on
Dear Judy!

For X with more than about 10'000 elements this C-Mex is faster than ANY(X==y) even in the worst case that y is not a membor of X:
http://www.mathworks.com/matlabcentral/fileexchange/26867
This function stops the comparison after the first match. Therefore for large arrays. e.g. 1E7 elements and if y appears early in X, it is much more efficient than ANY(X==y).

Good luck, Jan