NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Initializing arrays with non-default values

Hi,

 

I have a large array (300+ elements) and want it to be filled with all -1 at the start and not with 0.

 

A couple of (bad) ideas of mine:

- using an expression "array[0] = -1, array[1] = -1, ..." (a lot of typing work)

- using a for loop with an expression "array[Locals.k] = -1" (very slow)

- getting the array from "somewhere else" like e.g. a LabVIEW VI (cumbersome)

 

Is there some expression syntax I can use?

0 Kudos
Message 1 of 2
(3,885 Views)

You can use SetElements(Locals.d,-1)  where d is the array.

Message 2 of 2
(3,849 Views)