Help With IF AND statement
Ältere Kommentare anzeigen
Hi all
I am trying to code the following statement:-
"If Radius is between 500-600 AND Ton is greater than 58 then do the following..."
I have coded this as:-
if ((Radius >= 500) && (Radius <= 600)) & Ton > 58
But this doesnt work i get an output stating ans = logical 0.
Any ideas.
Thank you
3 Kommentare
Stephen23
am 6 Mär. 2019
It works for me:
>> Radius = 550;
>> Ton = 100;
>> ((Radius >= 500) && (Radius <= 600)) & Ton > 58
ans = 1
What values are you trying?
Walter Roberson
am 6 Mär. 2019
If you are using a radius or Ton value right near the boundary, for debugging, subtract the boundary from the actual value: the result might show you a small difference between the boundary and the actual value.
For example,
Radius = 500*(1-eps)
This will display as 500, but it is less than 500, and Radius - 500 would show the numeric difference.
John hope
am 6 Mär. 2019
Antworten (0)
Kategorien
Mehr zu Programming finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!