NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Expression for an empty array

Solved!
Go to solution

Hello,

 

I want to reset an Array. Numeric 1D.

 

It's getting written on in my Sequence and when the sequence is ended I want to reset it as an empty Array. I want to do this through a statement. Can someone please send me the propper Expression I Need to use to make it empty again? 

0 Kudos
Message 1 of 4
(2,812 Views)
Solution
Accepted by Riesengross

Hello Riesengross,

 

You can just set the number of elements in the array to 0, with this kind of statement:

 

Locals.MyArray.SetNumElements(0, 0x0)

 

Make sure your sequence is handling properly the empty array you've just reset.

 

Regards,

Message 2 of 4
(2,789 Views)

Thanks, that worked.

 

Another easy way is, as I found out,

simply to write:

Locals.MyArray = {}

 

Simple assign Nothing like in SCALA.

0 Kudos
Message 3 of 4
(2,774 Views)

Funny. "{}" seems to be interpreted as an "Array of Numbers(64-bit Floating Point)". Whenever you try to reset an array of a different type than that, it won't work. At least not in my Value expression that I'm trying to pass as a Parameter into a subsequence.

 

Static typing for the win!

 

So tell me NI, what's the literal for "empty array of containers"?

0 Kudos
Message 4 of 4
(1,675 Views)