LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

multiple temporary variables in a formula node

Hi,

I am able to create formula nodes with multiple inputs and a single expression
in the "box". But for several complicated expressions involving sqrt() and
trig functions, I want to use a formula node with multiple inputs, a single
output, and several (3 to 4) temporary variables within the formula node. Can
this be done?

An example (not actual code) of my expression in the node box is shown below.

---------------------------------------
A --> | double dval1, dval2, dval3; |
| |--> D
B --> | dval1 = sin( A*A - B ); |
| dval2 = cos( sqrt( A*B ) - B*B ); |
C --> | dval3 = atan( 23 + C*C ); |
|
|
| D = dval1 + dval2*dval2 - dval3; |
---------------------------------------

Why does this approach generate errors?

--
Mike
0 Kudos
Message 1 of 3
(4,267 Views)
Change the "Double" to "Float" and it should work. The formula node apparently does not distinguish between different floating point data types.

It took me a while to find this out. The help file should have this information in it but doesn`t.

Shane
Using LV 6.1 and 8.2.1 on W2k (SP4) and WXP (SP2)
0 Kudos
Message 2 of 3
(4,267 Views)
Answer found (I think) !

On my PC, in my "LabVIEW" directories, there is a header file called,
fundtypes.h. I saw that the C type, double, had been typedef-ed to float64.
I tried using float64 to declare "double" variables in my formula nodes and
they worked fine. There are other C variable types that have been typedef-ed
here, as well.

shoneill wrote:
> Change the "Double" to "Float" and it should work. The formula node
> apparently does not distinguish between different floating point data
> types.
>
> It took me a while to find this out. The help file should have this
> information in it but doesn`t.
>
> Shane

Mike
0 Kudos
Message 3 of 3
(4,267 Views)