Find index of cell containing strings from cell array

1 Ansicht (letzte 30 Tage)
Shana Hartel
Shana Hartel am 30 Aug. 2017
Beantwortet: Jan am 30 Aug. 2017
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!

Akzeptierte Antwort

Jan
Jan am 30 Aug. 2017
ismember(A(:, 2), B)

Weitere Antworten (0)

Kategorien

Mehr zu Characters and Strings finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by