if condition by comparing value with vector
显示 更早的评论
Hi,
I am trying to generate an if condition by comparing an value with a whole vector of values. If any is true, the if condition should execute.
In this example g should be true:
a = [1 2 3 4 5];
b = [8 9 10];
c = 10;
if c == a(:) || c == b(:)
g = true;
else
g = false;
end
I am sure there is a simple solution, I just dont know it.
Thanks everyone!
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Data Import from MATLAB 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!