Need an IF boolean that compares a number to all numbers in an array
信息
此问题已关闭。 请重新打开它进行编辑或回答。
显示 更早的评论
回答(1 个)
a = [1,2,3];
b = 2;
if any(b==a)
disp('b in a')
else
disp('b not in a')
end
Also, see the help for ISMEMBER. In this case it is not needed.
0 个评论
此问题已关闭。
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!