LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I modify one element of an array from a subVI?

I have a main VI that lets the user input several steps to create a method. The status of each step is a string which is part of an array. I pass the method to a subVI that runs all the steps, but I want to update the status of each step on the main VI as it is completed.

Right now I am sending the entire status array to the subVI, changing one element for each step, and rewriting the entire array with a control reference (to the main VI) after each step.

Is there a better way?
0 Kudos
Message 1 of 4
(2,892 Views)
Create a reference to that array and pass it into your subVI where you can change its value using property node.

A Rafiq
0 Kudos
Message 2 of 4
(2,892 Views)
I did that, but I am unable to access just the one element I want to change. I need to bring in the entire array, change the one value, then send the entire array back through the reference.

Is there a way to just change the one element, or is this the best way?

Thanks,
Steve
0 Kudos
Message 3 of 4
(2,892 Views)
Hi Steve,

If you just want to get that one element, you can index the array to grab that element, send it to your subvi, and upon change replace array subset, specifying the index again. Basically, you would do something similar to the vi example i have attached. Hope this helps!

Jeremy L.
National Instruments
Jeremy L.
National Instruments
0 Kudos
Message 4 of 4
(2,892 Views)