MATLAB: Find index of cell containing strings from cell array

cell arraystrings

How can I find the indices of cell A that contain any of the strings in cell B?
Example: A = cell(100,10). In column 2, I have a variety of fruits: apples, bananas, pears, grapes, rasberries etc. Some repeat. B = {'Apples', 'bananas', 'grapes'}
I want to find all the rows of A(:,2) that contain any of the strings in B.
Thanks!

Best Answer

ismember(A(:, 2), B)