05-29-2012 11:51 AM
Hello,
i want to ask, why this doesnt work:
if (((Y2>Y1)&&(X2>=X1))||((Y2<Y1)&&(X1>=X2)))
m=abs((X2-X1)/(Y2-Y1));
else if (Y1=Y2)
Y=Y1;
else
m=-abs((X2-X1)/(Y2-Y1));
doesnt else if function in labview?
Or is there another mistake?
The Output is motsly m=0 and Y=some value although Y is not equal to Y1
05-29-2012 12:01 PM
In VB, else if is one word elseif
05-29-2012 12:08 PM
You are not showing any LabVIEW code. Please be more specific.
Are you using this code in a formula node? In a MathScript node?
It would be so much easier for us if you could attach a simple VI.
05-29-2012 12:15 PM
And a compare is ==, not =.
A compare with only one = will always give true.
So in your case Y1=Y2 will always give true, but Y1==Y2 might not give always give true.
05-29-2012 12:28 PM - edited 05-29-2012 12:36 PM
I had problems with the picture size here.
Thanks for the correction until then.
Now i have an undefined variable after "elseif"...
05-29-2012 12:35 PM
@BluE12 wrote:
Sorry, if i add a picture, it looks like this: I hope you can maximize it.
While your image is 425x599, 99% of it is white background and the diagram is shrunk to the size of an average insect. You are doing something wrong. Maximizing won't increase the resolution.
Please attach the VI instead! Much easier!
05-29-2012 12:37 PM
That picture makes no sense. I can't read anything off it.
Make a new picture without any extra white space.
05-29-2012 12:42 PM - edited 05-29-2012 12:43 PM
For LabVIEW 8.6, under Formula Node syntax, there is no such thing as an Elseif that is found in other languages.
05-29-2012 12:48 PM
Why do place all that stuff on the BD? I would use the Linear Fit Coefficients VI.
05-29-2012 01:07 PM
@GuenterMueller wrote:
Why do place all that stuff on the BD? I would use the Linear Fit Coefficients VI.
I was wondering the same thing. I suspect lack of actual opening that obscure and mysterious thing called "LabVIEW Help".