Compare two cell array (different sizes) and return 0 or 1

1 回表示 (過去 30 日間)
Lucas S
Lucas S 2020 年 3 月 9 日
コメント済み: Lucas S 2020 年 3 月 9 日
Hello !
I have 2 cells array of string :
  • one which is general with many items like : A = {A, B, C, D, E, F, G, H};
  • and the seconde which is the one i want to compare with the other : B = {C, E, J};
How can i compare B and A and return 1 if all items of B are in A and 0 if not ?
Thans you for helping !

採用された回答

Adam Danz
Adam Danz 2020 年 3 月 9 日
編集済み: Adam Danz 2020 年 3 月 9 日
A = {'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H'};
B = {'C', 'E', 'J'};
idx = ismember(B,A);

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLanguage Fundamentals についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by