VeriStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Building a Model with 2D array fails

ok, that works with the file as well. So presumably I could have the model opening "lookup.csv" once,  and just change the content of that file prior to a run from the LV side so nothing would be hardcoded.

L.

0 Kudos
Message 11 of 19
(3,855 Views)

Yep, or you could just have multiple files for your lookup table, and pass in the path of the file you want to use to your model.

 

Matt M.

Applications Engineer
National Instruments
0 Kudos
Message 12 of 19
(3,854 Views)

You can set the 1D array parameter for your LabVIEW Model using the Set Parameter 2D Array Values.vi as shown below. Just construct a column or row vector as a 2D array and everything works properly.

 

2D_array.PNG

 

 

Jarrod S.
National Instruments
0 Kudos
Message 13 of 19
(3,848 Views)

Hi Jarrod,

There is still something I am missing here...Smiley Surprised What you are showing here is what I thought this API call was for. But where do I get the Lookup Table on the model side though, since the model build rejects 1D and 2D parameters ??

L. 

 

0 Kudos
Message 14 of 19
(3,845 Views)
For now... labview models don't support 2d parameters. However, they do work with 1d parameters. I've used two 1d parameters before as a look up table.

Create the array controls on the front panel. place data inside them until they are of the desired size. Right click the array itself (not an element) and make the value default. Save. Compile!
Stephen B
Message 15 of 19
(3,838 Views)

... So you are saying that the 1D parameter array in the model can be changed at run time using the Set Parameter  2D array...Smiley Frustrated .

0 Kudos
Message 16 of 19
(3,828 Views)

Stephen is correct. I would guess that setting the default value is the step you might have missed, since it is the least intuitive. The size of the parameter must be fixed when the LVModel is compiled. To set this size, the 1D array control must have a default value set of the correct size. I am attaching the test files I just used to test all this out if you want to take a look.

Jarrod S.
National Instruments
0 Kudos
Message 17 of 19
(3,827 Views)

You can definitely change the 1D array value from the API. Refer to the test model and API caller I just attached.

Jarrod S.
National Instruments
0 Kudos
Message 18 of 19
(3,826 Views)

I see... I was not using the 2D API call to set the 1D parameter... And to recap what you say, the array size must be set at pre-compiled time. Ok somewhat limiting, but can be dealt with...

 

As mentioned earlier, I also use a read file call (once) to load the look up table from a file on the RT machine. May slow down the iteration loop on this call but the file is not large ~ 17 Kbytes.

 

L.

0 Kudos
Message 19 of 19
(3,820 Views)