Clean way to find which elements of categorical array are part of a set of labels
显示 更早的评论
Hi. I have a categorical array. I want to find which elements belong to a set of labels. Here is an example of what I would like to write, but I obviously need some form of function here.
data = nominal( {'a', 'b', 'c', 'b', 'a'} )'
%This line will in fact not work, so I am looking for a clean way to write it.
isAorB = any(data == {'a', 'b'});
disp( isAorB );
1
1
0
1
1
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Categorical Arrays 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!