From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

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,276 Views)
Solution
Accepted by topic author 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,253 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,238 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,139 Views)