LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

array output from formula node

How to get an array output from the formula node.I am trying to use a for loop inside the formula node and want an array output.
Message 1 of 19
(19,851 Views)
Hi muks,

From the Help:

The default data type for output terminals is double-precision, floating-point. To change the data type, create an input terminal with exactly the same name as the output terminal and wire a data type to that input terminal. Doing so also provides a default value for the terminal. You also can use the Formula Node Syntax to define the variable inside the Formula Node. For example, int32 y; changes the data type of the output terminal y to 32-bit integer.


Like this:



Hope this helps

Dave


Message Edited by DavidU on 06-20-2008 04:31 PM

Message Edited by DavidU on 06-20-2008 04:32 PM
Download All
Message 2 of 19
(19,842 Views)
Check this site and try to run the VI attached!!!

http://digital.ni.com/public.nsf/3efedde4322fef19862567740067f3cc/9d72b6069346942386256a0d00604ed4?OpenDocument
LV 8.2
0 Kudos
Message 3 of 19
(19,841 Views)
You cannot place a For or While Loop inside the formula node.
 
Here is what the Help Description says about the syntax inside the Formula Node:
 
Formula Node

Evaluates mathematical formulas and expressions similar to C on the block diagram. The following built-in functions are allowed in formulas: abs, acos, acosh, asin, asinh, atan, atan2, atanh, ceil, cos, cosh, cot, csc, exp, expm1, floor, getexp, getman, int, intrz, ln, lnp1, log, log2, max, min, mod, pow, rand, rem, sec, sign, sin, sinc, sinh, sizeOfDim, sqrt, tan, tanh. There are some differences between the parser in the Mathematics VIs and the Formula Node.

 Place on the block diagram  Find on the Functions palette

Refer to Creating Formula Nodes and Formula Node Syntax for more information about the Formula Node and the Formula Node syntax.

Note  The Formula Node accepts only the period (.) as a decimal separator. The node does not recognize localized decimal separators.
<SCRIPT type=text/javascript>if (typeof(writeVarRefs)=="function"){writeVarRefs("763");}</SCRIPT> <SCRIPT type=text/javascript> if(typeof(lvrthelp763) != "undefined"){document.writeln(lvrthelp763)}</SCRIPT> <SCRIPT type=text/javascript> if(typeof(lvfpga763) != "undefined"){document.writeln(lvfpga763)}</SCRIPT> <SCRIPT type=text/javascript> if(typeof(lvemb763) != "undefined"){document.writeln(lvemb763)}</SCRIPT> <SCRIPT type=text/javascript> if(typeof(lvpdahelp763) != "undefined"){document.writeln(lvpdahelp763)}</SCRIPT> <SCRIPT type=text/javascript> if(typeof(lvtpchelp763) != "undefined"){document.writeln(lvtpchelp763)}</SCRIPT> <SCRIPT type=text/javascript> if(typeof(lvblackfin763) != "undefined"){document.writeln(lvblackfin763)}</SCRIPT> <SCRIPT type=text/javascript> if(typeof(lvdsp763) != "undefined"){document.writeln(lvdsp763)}</SCRIPT>

Example

Refer to the Create Function with Formula Node VI in the labview\examples\general\structs.llb for an example of using the Formula Node.

Message 4 of 19
(19,825 Views)
Well, something really strange happened with the pasting there. Smiley Surprised
0 Kudos
Message 5 of 19
(19,818 Views)
It looked perfect when I was submitting it...  😠
 
Strange indeed..
 
Lemme try again..
 

Refer to Creating Formula Nodes and Formula Node Syntax for more information about the Formula Node and the Formula Node syntax.

Note  The Formula Node accepts only the period (.) as a decimal separator. The node does not recognize localized decimal separators.

Example

Refer to the Create Function with Formula Node VI in the labview\examples\general\structs.llb for an example of using the Formula Node.




Message Edited by JoeLabView on 06-20-2008 12:39 PM
0 Kudos
Message 6 of 19
(19,811 Views)
Aside from the image that looked OK. I know the image won't show since the link is to the file system, as expected.

Also, I don't think the user is trying to actually place a LabVIEW for-loop or while loop inside the formula node. At least, I don't think so. To OP: You will need to write a for loop using the Formula Node syntax. E.g.:




Message Edited by smercurio_fc on 06-20-2008 11:41 AM
Message 7 of 19
(19,801 Views)
Hi,
According to the Formula node syntax you can use do, for and while loops (about half way down the list)

ie

iterative-statement:

    do-statement
    for-statement
    while-statement

do-statement:

    do statement while ( assignment )

while-statement:

    while ( assignment ) statement

for-statement:

    for ( [assignment] ; [assignment] ; [assignment] ) statement



Although I've not actually tried it

Dave

Message 8 of 19
(19,799 Views)
smercurio beat me to it!!Smiley Mad

DaveSmiley Very Happy
0 Kudos
Message 9 of 19
(19,794 Views)

I should have put this in bold:  😄

Evaluates mathematical formulas and expressions similar to C on the block diagram.

Expressions include the statements David & smercurio mentionned.. 

I was too hasty with the C/P!!  😉

Message 10 of 19
(19,790 Views)