searching cell array of strings

조회 수: 24 (최근 30일)
Anthony
Anthony 2011년 8월 23일
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일
strcmp(string,cellstr)
  댓글 수: 1
Jan
Jan 2011년 8월 23일
And: find(strcmp(string, cellstring))

댓글을 달려면 로그인하십시오.


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

카테고리

Help CenterFile Exchange에서 Characters and Strings에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by