searching cell array of strings

20 Ansichten (letzte 30 Tage)
Anthony
Anthony am 23 Aug. 2011
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?

Antworten (2)

Oleg Komarov
Oleg Komarov am 23 Aug. 2011
strcmp(string,cellstr)
  1 Kommentar
Jan
Jan am 23 Aug. 2011
And: find(strcmp(string, cellstring))

Melden Sie sich an, um zu kommentieren.


Fangjun Jiang
Fangjun Jiang am 23 Aug. 2011
Or maybe strfind(), regexp();
C = {'hello' 'yes' 'no' 'goodbye'};
S='ye';
Found=strfind(C,S);
Ind=~cellfun('isempty',Found);
C(Ind)

Kategorien

Mehr zu Characters and Strings finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by