LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

formula node

I need a formula node with one input and one output.
For input > 20;
output = 5;
else
output = 0;
 
How do I write this in the formula node?
0 Kudos
Message 1 of 9
(3,128 Views)
Smiley Indifferent I am not sure that a formula node is the best tool to do that...

What about this :


Message Edité par TiTou le 07-07-2006 11:37 AM


We have two ears and one mouth so that we can listen twice as much as we speak.

Epictetus

Antoine Chalons

Message 2 of 9
(3,125 Views)

You have simpler options for doing this sort of operation

you dont need no formula node for that!

On block diagram First use  'greater than' function ( look in  comparison tools), to find if input > 20. Next wire the boolean output to 's' input in  'select' function ( found in comparisons tools)

Wire  a numeric constant '5' to input teminal named 't' in 'select' function

Wire  a numeric constant '0' to input teminal named 'f' in 'select' function

If input 's' is true, select shall pass '5' in its output,If input 's' is false, select shall pass 'o' in its output

hope this helps.

How I wish that presently LabVIEW was installed on my system, so that i could have posted a snapshot of the block diagram Smiley Sad

Message 3 of 9
(3,120 Views)

Ha!

TiTou beats me to that while I am typing the script!Smiley Tongue

Thats what I was trying to explain in words!

In LabVIEW, functions speak louder than mere words! Smiley Very Happy

 

0 Kudos
Message 4 of 9
(3,120 Views)
Hi Dev,
I beat you on the finished line because LabVIEW lets you draw code faster than you speak ! Smiley Tongue
In other words : LABVIEW ROCKS !

Save the word, show the code Smiley Very Happy


We have two ears and one mouth so that we can listen twice as much as we speak.

Epictetus

Antoine Chalons

Message 5 of 9
(3,116 Views)

Aye to that!

cheers!

on the rocks!

0 Kudos
Message 6 of 9
(3,108 Views)
I would use operator primitives as well, but the original question was how to do it with the formula node.

Here is one formula that would work:
(input > 20)?(output=5):(output=0);

I like it because it is all in one single statement.

An easier to understand formula would also work:
if (input>20)
(output=5);
else(output=0);

Hope that this helps,
Bob Young


0 Kudos
Message 7 of 9
(3,093 Views)
Hmmm, I don't really know what language it is (C or C++ Smiley Surprised ) .. I've completely forgotten how to spell C now that I develop with LabVIEW Smiley Very Happy

I understood you wanted a formula node, but I did not understood WHY...
If you are developping soft with LabVIEW, why not using LabVIEW functions ? As time goes by I think there are less and less things that can be done in C and not in LabVIEW.

Moreover, I think your line of C code should work in a formula node... Smiley Indifferent

Write in G
Check this out Smiley Very Happy !

We have two ears and one mouth so that we can listen twice as much as we speak.

Epictetus

Antoine Chalons

0 Kudos
Message 8 of 9
(3,088 Views)
Hi,
Thanks for good answers, I think LV functions is the easiest way to solve this, but I just explained it simple to get to know how to use a "FOR" function in the formula node....
 
-Christian 😉
0 Kudos
Message 9 of 9
(3,059 Views)