05-07-2010 09:30 AM
Can anyone let me know what the syntax error is in this
if((A>=1.70)&(A<=1.71))
A=1
if((A>=1.34)&(A<=1.36))
A=1
if((A>=0.925)&(A<=0.935))
B=1
if((A>=1.305)&(A<=1.32))
B=1
if((A>=1.935)&(A<=1.941))
C=1
if((A>=1.72)&(A<=1.73))
D=1
if((A>=1.70)&(A<=1.71))
E=1
if((A>=1.65)&(A<=1.66))
F=1
if((A>=1.29)&(A<=1.30))
G=1
if((A>=1.0)&(A<=1.05))
H=1
else
I=1
end
thanks chris
Solved! Go to Solution.
05-07-2010 10:13 AM - edited 05-07-2010 10:19 AM
I assume you want all of those if's (except the first one) to be an elseif. If this is not the case, then you want to put an end after each individual if.
Also, it's not a bad idea to throw a ; at the end of each statement. (Not the lines containing if, elseif or end)
Also, you probably want to use && instead of &. I'm not sure if mathscript differentiates between the two, but I know some languages do. The help file for mathscript uses &&, so I'd go with that. Anyone care to confirm if there's a difference?
05-07-2010 10:41 AM
Thanks for your help with this,the coding now works. Also && works as well but I think a single & also works.
Thanks
Chris
05-07-2010 10:52 AM
Some information about the difference between the & and && operators is presented in this thread.
Grant M.
Senior Software Engineer | LabVIEW MathScript | National Instruments
05-07-2010 11:26 AM