LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

else if

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

0 Kudos
Message 1 of 11
(3,320 Views)

In VB, else if is one word elseif

 

0 Kudos
Message 2 of 11
(3,313 Views)

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.

0 Kudos
Message 3 of 11
(3,309 Views)

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.

0 Kudos
Message 4 of 11
(3,303 Views)

I had problems with the picture size here.

Thanks for the correction until then.

Now i have an undefined variable after "elseif"...

Neues Bild.JPG

0 Kudos
Message 5 of 11
(3,294 Views)

@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!

0 Kudos
Message 6 of 11
(3,280 Views)

That picture makes no sense. I can't read anything off it.

Make a new picture without any extra white space.

0 Kudos
Message 7 of 11
(3,275 Views)

For LabVIEW 8.6, under Formula Node syntax, there is no such thing as an Elseif that is found in other languages.

 

0 Kudos
Message 8 of 11
(3,272 Views)

Why do place all that stuff on the BD?  I would use the Linear Fit Coefficients VI.

Message 9 of 11
(3,253 Views)

@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".

0 Kudos
Message 10 of 11
(3,234 Views)