次のようなセルがあるとします
A = {'erogol' 'grerol' 'biral'}
次に、特定の文字列を内部で検索します。
それを行う特別な機能はありますか?
関数の1つは次のstrmatch
とおりです。
index = strmatch('grerol',A,'exact');
インデックスの配列を返します。現在は廃止されており、Mathworks はstrcmp
代わりに使用することを推奨しています
logicalIndexing = strcmp('grerol',A);
別のオプションはismember
次のとおりです。
[bIsMember,index]=ismember('grerol',A);
別のオプションはstrfind
次のとおりです。indexs = strfind(A,'grerol');
最後だが大事なことは、
booleanIndexes = cellfun(@(x)(isequal(x,'grerol')),A);