MATLAB: Find indexes of strings that have special characters.

MATLABstring

I have column that consist of strings
eg.
someString
String
otherString
someString
String
and I want to get idexes of strings that have word 'some' or 'other' inside it.
so the result of the function will be [1,3,4].

Best Answer

a = {'someString';'String';'otherString';'someString';'String'};
out = find(~cellfun('isempty',regexpi(a,'some|other')));