LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Does Reinit To Default set an Array size to zero?

Solved!
Go to solution

Does the function Reinit To Default set a 2D Array size to zero? The Help is not explicit on this.

 

If not, what is the best way to set a 2D Array size to zero?

0 Kudos
Message 1 of 5
(2,971 Views)

Yes, it sets the size of an array to zero elements, unless the default value is defined otherwise (right click, make current value default.).

 

There are several ways to empty an array indicator/control.Normally I write it's value to the terminal or to a local variable. I have never used 'Reinit values to default'

 

Ton

 

Free Code Capture Tool! Version 2.1.3 with comments, web-upload, back-save and snippets!
Nederlandse LabVIEW user groep www.lvug.nl
My LabVIEW Ideas

LabVIEW, programming like it should be!
0 Kudos
Message 2 of 5
(2,956 Views)
Solution
Accepted by topic author dbaechtel

From the "it takes less time to just try it than to post a message asking if it does it": the answer is yes. But only if the default value is an empty array to begin with. Obviously.

 

 


If not, what is the best way to set a 2D Array size to zero?

Wire an empty array constant to your choice of a local variable or a "Value" property node, taking into account the elimination of any potential race conditions.

 

Message 3 of 5
(2,954 Views)

I was using Reinit To Default on a 2D Array of Strings and it looked like it was not setting the size to zero.

 

I'll try writing the 2D Array Constant to the Value instead.

0 Kudos
Message 4 of 5
(2,940 Views)

 


@dbaechtel wrote:

I was using Reinit To Default on a 2D Array of Strings and it looked like it was not setting the size to zero.

 


 

I would be very interested in such a code (unless you can confirm that the default value was changed).

 

Ton

Free Code Capture Tool! Version 2.1.3 with comments, web-upload, back-save and snippets!
Nederlandse LabVIEW user groep www.lvug.nl
My LabVIEW Ideas

LabVIEW, programming like it should be!
0 Kudos
Message 5 of 5
(2,883 Views)