LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

formula node

Hi,
 
I´m try make this in formula node but i cant do this?
 
if(x==0)
y=y
else
Y=y+1
 
my input is x and my output is y...
 
how can i do this ...i try wired y at other input but i cant do this...
0 Kudos
Message 1 of 11
(6,275 Views)
It would probably be easier to wire this up using LabVIEW primitives, but you should be able to do it in a formula node.

Your formula node needs two inputs, x and Yin. The same terminal cannot be both input and output.

Lynn
0 Kudos
Message 2 of 11
(6,257 Views)

I cant do this because, my problem is that y is my imput and my output!!!

because sepending of x i have to incremente y=y++ or y=y

my question is how use y its is with local variables i dont konw i make it!??

0 Kudos
Message 3 of 11
(6,253 Views)
Unless you absolutely have to use formula node, why don't you just use case structure.  When x==0, true and wire y through, if false then add +1 to y.  Make sure the output are connected.  Hope this helps.
RJU
0 Kudos
Message 4 of 11
(6,239 Views)

You need a shift register or feedback node. In 8.5, you don't need a while loop for the feedback node. Try one of examples below.

Message Edited by Dennis Knutson on 10-12-2007 11:37 AM

0 Kudos
Message 5 of 11
(6,237 Views)
your formula node would be:
if (x==0) y=y;
 else y=y+1;

where x and y are input and y is the output. 
You will have to shift y output back to the y input for the formula node in a for or while loop external to the formula node.
But this would be easy to do with labview natives as well.
I have attached an image of both methods.

I see, someone had beaten me to the punch.

Message Edited by Stradis on 10-12-2007 01:39 PM


Paul
0 Kudos
Message 6 of 11
(6,232 Views)
thnaks all people,
 
but my doubt is now is the following:
 
in the shift register i dont have to wire nothing at input!?
 
i make the first mount that Dennis Knutson  suguested!!?but isnt work!!?
 
Thanks
0 Kudos
Message 7 of 11
(6,216 Views)
A shift register can be initialized or not. When unitialized, the first time the code in the top image is run, the initial value of y will be 0. Thereafter, it will retain the previous value. Since you've not given anyone the context in which you want to run this code and not anything more than 'but isn't work', it's hard to say what else you need to do. Post the entire VI where you are are using this.
0 Kudos
Message 8 of 11
(6,204 Views)
this is my vi..
 
I can´t open this at home because my version is 8.0 and in school i work with 8.2.
 
thanks for attention
 
 
0 Kudos
Message 9 of 11
(6,192 Views)
Remove the definition of the local variable y (You already have an input with this name.). Simply specify in the Formula Node:
if(x==0) y=y; else y=y+1;
 
If you don't like reading "if" and "else" (like me) you can use the conditional operator to get the same result:
y = (0==x) ? y : ++y;
 
Regards, Guenter
0 Kudos
Message 10 of 11
(6,176 Views)