LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

If-then statement in formula node

**Note - The attached file shows the current block diagram.

I have a formula node inside a for loop. Inside the formula node I am trying to program the if-then statement:

If T1<2.0E-5 OR T1>5.5E-4 THEN GOTO 3
U7=U7+V

I have 4 items I need help with:
(1) Is 'II' the correct operator for 'OR'?
(2) Is 'goto' an acceptable operator within LabVIEW?
(3) 'U7' is building a 1D array. How do I need to define it? Is it simply 'int U7'? Also, I will add an output value named 'U7' on the formula node wall with an indicator wired to it from outside the for loop.
(4) Is my use of the equal sign appropriate or do I need to use '=='?

Thanks for the help.

Philip
0 Kudos
Message 1 of 4
(4,687 Views)
1) "||" is correct but not "II" - you've got capital I - use the character above the "\" key.
2) No goto's allowed as far as I know.
3) To declare an array U7 with 5 elements for example, use int32 U7[5];
4) Depends. Use = for assignment and == for equality comparison.
Message 2 of 4
(4,687 Views)
Thanks for the help. I went ahead and rewrote the program so I could omit the 'goto's. Another problem that I am having is that I want 2 statements for 1 assignment:

if (T1>=.002004 && T1<=.002584)
B1=U
A1=V;

I want to assign both B1 and A1 values when the above condition is true. I tried a comma between the U and A1 but it doesn't work as well. Should I define A1 and B1 separately? Or would this create problems?

if (T1>=.002004 && T1<=.002584)
B1=U;
if (T1>=.002004 && T1<=.002584)
A1=V;



Thanks,
Philip
0 Kudos
Message 3 of 4
(4,687 Views)
I believe the correct way to do it is to group your statements with curly brackets -
if (T1>=.002004 && T1<=.002584) {
B1=U;
A1=V;
}

There's several shipping examples of how to use formula nodes. You might want to look at them.
0 Kudos
Message 4 of 4
(4,687 Views)