IF condition with interval
31 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Quantopic
am 25 Aug. 2014
Kommentiert: Ara Alexandrian
am 10 Apr. 2017
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 Kommentare
Akzeptierte Antwort
the cyclist
am 25 Aug. 2014
Bearbeitet: the cyclist
am 25 Aug. 2014
You have to write it as two sub-conditions:
if (0<X) && (X<1)
2 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu 2-D and 3-D Plots finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!