What is the best way to execute 2 if conditions in MATLAB
6 次查看(过去 30 天)
显示 更早的评论
assume w=[1 2 2 2]
q=[2 1 1 1]
if w(i)==1
do somehing
else
look to q(i)
if q(i)==1
do some thing
else
do somthing
end
end
0 个评论
采纳的回答
更多回答(1 个)
Walter Roberson
2014-4-30
if w(i) == 1
do somehing
elseif q(i) == 1
do some thing
else
do somthing
end
2 个评论
José-Luis
2014-5-1
It will check nothing. It will run that bit only if any of the first two conditions are not satisfied.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Octave 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!