This widget could not be displayed.
This widget could not be displayed.

LabVIEW MathScript RT Module

This widget could not be displayed.
cancel
Showing results for 
Search instead for 
Did you mean: 

array initialization

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
This widget could not be displayed.
This widget could not be displayed.
This widget could not be displayed.
0 Kudos
Message 1 of 6
(9,764 Views)
Hello,

Unfortunately, array initialization in the formula node does not work at declaration.  You have to initialize each element individually.  However, if you are using LabVIEW 8.0 or later, you can use the LabVIEW MathScript node.  MathScript does not use types, so you don't have to declare the variables.  You can initialize an array with the following code:
data = [0, 1, 2, 3, 4];

Grant M.
Staff Software Engineer | LabVIEW Math & Signal Processing | National Instruments
This widget could not be displayed.
This widget could not be displayed.
This widget could not be displayed.
0 Kudos
Message 2 of 6
(9,749 Views)
I have created an input node in the formula node. When I try to wire a 2d array to the input I get an error of type mismatch. I need to manipulate an array inside the formula node. I am using labview 8.0.  Could someone tell me what I am doing wrong?

This widget could not be displayed.
This widget could not be displayed.
This widget could not be displayed.
0 Kudos
Message 3 of 6
(9,277 Views)

RSibagatullin,

Formula Nodes should accept 2D array inputs without any problem.  Can you attach a VI that demonstrates the problem you are seeing?

Chris M

This widget could not be displayed.
This widget could not be displayed.
This widget could not be displayed.
0 Kudos
Message 4 of 6
(9,273 Views)
I have attached the vi. I think I solved the problem of  2D array input. But now I have a question of syncronization of output  of formula node with the rest of VI. As you can see I am writing to an outside array  based on some cells from that array. How will labview know when to read ro,co,vo (row output,column output, value output) while the formula node runs the code?
This widget could not be displayed.
This widget could not be displayed.
This widget could not be displayed.
0 Kudos
Message 5 of 6
(9,270 Views)

Hi,

LabVIEW follows a dataflow model for running VIs. A block diagram node executes when it receives all required inputs. When a node executes, it produces output data and passes the data to the next node in the dataflow path. The movement of data through the nodes determines the execution order of the VIs and functions on the block diagram.

You can use execution highlighting to view an animation of the execution of the block diagram.

This widget could not be displayed.
This widget could not be displayed.
This widget could not be displayed.
0 Kudos
Message 6 of 6
(9,246 Views)