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.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Create an array and populate programmatically

Solved!
Go to solution

I am creating a new VI with an array of strings using VI scripting.  Now, I want to populate that array from a constant array of strings.  What is the best way of doing that?

 

Below is a screenshot of the code that I have so far.  What I have populates the first element of the array, but I can't figure out how to access the other elements. Any suggestions?

 

Thanks,

 

Emily

 

 

 

CreateArray.png

0 Kudos
Message 1 of 4
(4,784 Views)
Solution
Accepted by topic author Emily101

After you put the string in the array (part of the creation), you should just close out that reference.  You should be setting the value of the Array.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 2 of 4
(4,782 Views)

Hi Crossrulz

 

I couldn't understand the solution you mentioned. I have to add values in the higher indices of array (which I create in another VI through VI scripting). For this, I am running a loop to populate an array, but all the values are overwritten on index 0 of array. Screen shot is attached.

 

Regards

HB

0 Kudos
Message 3 of 4
(4,436 Views)

If you are populating an array, you need to write the entire array to the array control.  You can't just write a single element with a property node.  So read the current value, change/add whatever values you need to, and then write the new array back into the control.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 4 of 4
(4,417 Views)