LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I modify an array from within a loop?

I need to modify an array from within a loop for use on subsequent passes through the loop. How do I do this?
0 Kudos
Message 1 of 4
(2,948 Views)
If the question is how to save the array so you can use it on further iterations then you can use a shift register. To do this right click on the edge of the while loop and choose Add Shift Register. If you then drag the shift register down to increase it's size on the left hand side of the loop you will have access to previous forms of the array.
Message 2 of 4
(2,948 Views)
This is what I eventually came up with on my own. My concern is that this will incur excessive memory management overhead that will cause the timing of my loop to fail. We'll see. (I can't test it now because the system that this VI operates on is down for rework.)
0 Kudos
Message 4 of 4
(2,948 Views)
Hi

What you will Have to do is the Following.

1. Create a Shift register. The Input of the Shift register van be wired with a Constant and left empty. The Constant is of same type as your array.(2D,1D etc.)

2. Within the Loop - Use the Function Build Array. If you right Click on the Input Terminals of Buil Array. You should see "Concatenate Inputs". Make sure this is Clicked Yes. Make Sure the Function shows two input Terminals

3. Now Wire your Input Side Shift register to One of the Inputs. The Other Input will be the Data or Information which you want to append to this array.

4. Wire the output of the Build Array Function to the Output Side Shift Register.

This basically initializes an Empty array of the type you want . On Every iteration of the loo
p a Data Point is addedto the Array, for use during next iteration.

When the Loop Exits the Out put of the Shift register is the Array with all the data.

Good Luck!!

Mache
Good Luck!

Mache
0 Kudos
Message 3 of 4
(2,948 Views)