non-looping way to compare cellstr arrays of different sizes
1 回表示 (過去 30 日間)
古いコメントを表示
Suppose A = {'aa', 'kk', 'ccc'}, B = {'aa', 'bb', 'cc', 'dd', 'ee'}.
Is there a not-explicitly-looping way to return a logical array the same size as A that is 1 where an element of A is in B, 0 where it is not, e.g.,
"whereMember"(A,B) => [1 0 0]?
Thanks!
0 件のコメント
採用された回答
Oleg Komarov
2011 年 8 月 24 日
A = {'aa', 'kk', 'ccc'};
B = {'aa', 'bb', 'cc', 'dd', 'ee'};
ismember(A,B)
4 件のコメント
その他の回答 (1 件)
David Goldsmith
2011 年 8 月 24 日
7 件のコメント
Jan
2011 年 8 月 25 日
@David: I've tried to let leo.org tell me, what affiliation is. Leo meant, that either somebody adopts me, or that it concerns my fatherhood. :-) If this means my company: I'm a freelancer. Perhaps my FEX author ID 15233 is helpful?
参考
カテゴリ
Help Center および File Exchange で Resizing and Reshaping Matrices についてさらに検索
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!