Effacer les filtres
Effacer les filtres

Filtering elements of a cell array and indexing

1 vue (au cours des 30 derniers jours)
Waqas Syed
Waqas Syed le 4 Sep 2016
Commenté : Waqas Syed le 4 Sep 2016
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.

Réponse acceptée

Andrei Bobrov
Andrei Bobrov le 4 Sep 2016
idx = find(cellfun(@(x)strcmp(x,chan_group_p1),groups));

Plus de réponses (0)

Catégories

En savoir plus sur Matrix Indexing dans Help Center et File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by