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 中查找有关 Characters and Strings 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!