searching cell array of strings
9 次查看(过去 30 天)
显示 更早的评论
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?
0 个评论
回答(2 个)
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)
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Characters and Strings 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!