On 10/15/2010 03:22 PM, James Sherman Jr. wrote:
> I'm not familiar with match, or how it works, but I think I can offer an
> alternative. I use the function "cellfun" a lot for what I think you're
> trying to do. For example, if you say wanted to find all the even
> entries in a cell array,
>
> a = {0, 3, 4, 9, 10};
> indices = cellfun(@x (mod(x,2))==0, a);
^^^ syntax error
> even_entries = a(indices);
>
> cellfun maps each element in the cell array to what the output to the
> function is, and since it is logical output, we can use that to index
> into the cell array to get the even entries.
indices = cellfun(@(x) mod(x,2)==0, a);
Gordon