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?

Respuestas (2)

Oleg Komarov
Oleg Komarov el 23 de Ag. de 2011

0 votos

strcmp(string,cellstr)
Fangjun Jiang
Fangjun Jiang el 23 de Ag. de 2011
Or maybe strfind(), regexp();
C = {'hello' 'yes' 'no' 'goodbye'};
S='ye';
Found=strfind(C,S);
Ind=~cellfun('isempty',Found);
C(Ind)

Categorías

Más información sobre Characters and Strings en Centro de ayuda y File Exchange.

Preguntada:

el 23 de Ag. de 2011

Community Treasure Hunt

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

Start Hunting!

Translated by