'Or' statement in matlab?
5 次查看(过去 30 天)
显示 更早的评论
How can I do this without using else if?:
if balls == 0 & ( x > 5 OR y > 7)
run xscript
end
Thanks,
4 个评论
采纳的回答
Image Analyst
2012-9-7
编辑:Image Analyst
2012-9-7
You need two &&:
if balls == 0 && ( x > 5 || y > 7)
% run xscript
xscript();
end
5 个评论
Image Analyst
2012-9-7
I've seen that before - where the vertical lines don't appear. However I can't reproduce anymore. For me | appears both in regular text, and code formatted text. By the way, I edited by answer to change "run xscript" to be just "xscript" since the "run" command like you had is not needed.
更多回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!