Do you want to search for 'bla' within the text in each element of the cell array, or for elements that are 'bla' exactly? If you explain this detail, then your question would be easier to answer.
If you are searching for text that has 'bla' as part of the text, then starting in R2016b you can use the “contains” function, as Alexander Cranney pointed out.
Index = find(contains(C,'bla'));
In previous versions of MATLAB, you can use the “strfind” function. However, “strfind” returns a cell array of indices. For any input cell whose text does not contain 'bla', “strfind” returns an empty cell. Use “isempty” and “cellfun” with the “find” function to find the empty cells.
IndexC = strfind(C,'bla');
Index = find(not(cellfun('isempty',IndexC)))
If you are searching for text that is exactly 'bla', then see Jos’ answer.
7 件のコメント
このコメントへの直接リンク
https://jp.mathworks.com/matlabcentral/answers/2015-find-index-of-cells-containing-my-string#comment_3926
このコメントへの直接リンク
https://jp.mathworks.com/matlabcentral/answers/2015-find-index-of-cells-containing-my-string#comment_3926
このコメントへの直接リンク
https://jp.mathworks.com/matlabcentral/answers/2015-find-index-of-cells-containing-my-string#comment_3934
このコメントへの直接リンク
https://jp.mathworks.com/matlabcentral/answers/2015-find-index-of-cells-containing-my-string#comment_3934
このコメントへの直接リンク
https://jp.mathworks.com/matlabcentral/answers/2015-find-index-of-cells-containing-my-string#comment_4088
このコメントへの直接リンク
https://jp.mathworks.com/matlabcentral/answers/2015-find-index-of-cells-containing-my-string#comment_4088
このコメントへの直接リンク
https://jp.mathworks.com/matlabcentral/answers/2015-find-index-of-cells-containing-my-string#comment_131581
このコメントへの直接リンク
https://jp.mathworks.com/matlabcentral/answers/2015-find-index-of-cells-containing-my-string#comment_131581
このコメントへの直接リンク
https://jp.mathworks.com/matlabcentral/answers/2015-find-index-of-cells-containing-my-string#comment_131604
このコメントへの直接リンク
https://jp.mathworks.com/matlabcentral/answers/2015-find-index-of-cells-containing-my-string#comment_131604
このコメントへの直接リンク
https://jp.mathworks.com/matlabcentral/answers/2015-find-index-of-cells-containing-my-string#comment_487774
このコメントへの直接リンク
https://jp.mathworks.com/matlabcentral/answers/2015-find-index-of-cells-containing-my-string#comment_487774
このコメントへの直接リンク
https://jp.mathworks.com/matlabcentral/answers/2015-find-index-of-cells-containing-my-string#comment_487780
このコメントへの直接リンク
https://jp.mathworks.com/matlabcentral/answers/2015-find-index-of-cells-containing-my-string#comment_487780
サインインしてコメントする。