Find index of cell containing strings from cell array

1 次查看(过去 30 天)
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!

采纳的回答

Jan
Jan 2017-8-30
ismember(A(:, 2), B)

更多回答(0 个)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by