LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

array init in formula node

I would like to cut and past in a list of comma seperated numbers and initialize an array of float32.  Something like this would work in C.
 
float32 data[5] = {0,1,2,3,4};
 
Labview does not like this syntax when using a formula node.  I have to do the following instead
 
float32 data[5];
 
data[0] = 0;
data[1] = 1;
...
 
What is the correct syntax for initializing arrays in lavview using a formula node.  I would be amazed if Labview does not have this basic functionality.
 
thanks in advance
jim bob
0 Kudos
Message 1 of 5
(12,086 Views)
ttt, no one?
0 Kudos
Message 2 of 5
(12,060 Views)
Hi Jim Bob,

most often it's easier/faster/better to use LabView primitives instead of sticking to C syntax. This not only applies to the command you want to use, this applies to the formula node in general...

So why don't you initialize the array in LabView either by placing an array constant or by reading in some csv files?
Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 3 of 5
(12,054 Views)


@labview_noob wrote:
ttt, no one?

Probably because we are using LabVIEW to get away from text based code. 😮

(I don't know if there is a syntax for the formula node, it's been too long. ;))

If you have LabVIEW 8.0 or higher, you can use matlab like sytax in a mathscript node. Of course you could just paste your list into a string constant and get the values with "spreadsheet string to array".


Message Edited by altenbach on 07-25-2007 12:24 AM

Message 4 of 5
(12,054 Views)
thanks, mathscript node is prabably the way to go.  Of course I am not using formula nodes everywhere, but to paste in a 1000 values, little boxes and wires just aren't cutting the cheese. 
 
thanks for the help.
jim bob.
0 Kudos
Message 5 of 5
(12,032 Views)