MATLAB: Find cell containing part of a string

find

I would like to find the elements of a cell array that contain part of a specified string.
colorList = {'Red', 'Green', 'Blue', 'Purple'}; % List of values to match with
stringToCheck = 'Blue 23948723'; % String we are trying to match
I would like to return index=3 of colorList since that entry contains the stringToCheck text of 'Blue'. How can I do this?

Best Answer

If you cannot assume that keywords are separated by white spaces:
>> find(cellfun(@(x)~isempty(strfind(stringToCheck,x)), colorList))
ans =
3