searching cell array of strings

Is there a way to use the 'find' function or something like it to search a cell array of strings for a particular string and return it's location in the cell array?

Réponses (2)

Oleg Komarov
Oleg Komarov le 23 Août 2011

0 votes

strcmp(string,cellstr)

1 commentaire

Jan
Jan le 23 Août 2011
And: find(strcmp(string, cellstring))

Connectez-vous pour commenter.

Fangjun Jiang
Fangjun Jiang le 23 Août 2011

0 votes

Or maybe strfind(), regexp();
C = {'hello' 'yes' 'no' 'goodbye'};
S='ye';
Found=strfind(C,S);
Ind=~cellfun('isempty',Found);
C(Ind)

Catégories

En savoir plus sur Characters and Strings dans Centre d'aide et File Exchange

Question posée :

le 23 Août 2011

Community Treasure Hunt

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

Start Hunting!

Translated by