IF condition with interval
247 次查看(过去 30 天)
显示 更早的评论
I want to have a script that runs if the variable X is within 0 and 1. I writed down the following code:
if 0 < X < 1
statement
else display(NaN)
end
The output script isn't an error but the if condition is not respected and values are away from the interval.
How can I solve this problem. Thanks in advance.
0 个评论
采纳的回答
the cyclist
2014-8-25
编辑:the cyclist
2014-8-25
You have to write it as two sub-conditions:
if (0<X) && (X<1)
2 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Assembly 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!