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 Exchange에서 Characters 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