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?

回答 (2 件)

Oleg Komarov
Oleg Komarov 2011 年 8 月 23 日

0 投票

strcmp(string,cellstr)

1 件のコメント

Jan
Jan 2011 年 8 月 23 日
And: find(strcmp(string, cellstring))

サインインしてコメントする。

Fangjun Jiang
Fangjun Jiang 2011 年 8 月 23 日

0 投票

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

カテゴリ

ヘルプ センター および File ExchangeCharacters and Strings についてさらに検索

質問済み:

2011 年 8 月 23 日

Community Treasure Hunt

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

Start Hunting!

Translated by