MATLAB: Filtering elements of a cell array and indexing

cellcell arraysfindindexing

Hi,
I have attached a mat file. In the file there are two variables; "groups" and "chan_group_p1".
I would like to obtain a vector with indices of locations of the cell array "groups" on which the content of variable "chan_group_p1" are present.
I tried to do something like followng but it does not work: id= find(groups==chan_group_p1);
My understanding of different kinds of variables in matlab is not so good. Let me know how I should do this task.

Best Answer

idx = find(cellfun(@(x)strcmp(x,chan_group_p1),groups));