LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how can I collect data from each iteration of a loop into a array of the data generated?

I want to collect the data generated after each iteration of a while loop and use this in conjunction with another set of data generated during the loop to create a separate plot.
0 Kudos
Message 1 of 4
(3,268 Views)
Gentmol wrote:
> I want to collect the data generated after each iteration of a while
> loop and use this in conjunction with another set of data generated
> during the loop to create a separate plot.

Just wire the data out of the loop and turn on Auto Index.
You will then have an array of all the values generated.
This will only become available whem the loop ends.
0 Kudos
Message 2 of 4
(3,268 Views)
The way I understand it, you want to watch the new data as it is being generated, overlayed over a complete set, e.g. from an earlier run.

The details of the implementation depend a little bit on your loop rate, but basically you setup a 2D array (Size 2xN), where (1,x) contains the old data and (2,x) is initialized with NaN. This feeds into a shift register of your loop.

Inside the loop you use replace array element at index (2,n), using replace element and the loop index as "n" and hook the output into a graph.

Let me know if this is clear enough. If this does not answer your question, please further clarify what you want to do.
Message 3 of 4
(3,268 Views)
There is another way to colect data very similar to the "replace array element" function method, here it is:

Add a Shift Register on the while loop using the command "add shift register" on the pop up menu by clicking on the border of the loop with the right button of the mouse. Create and conect a blank numeric array constant with the dimension size you want to use outside the loop and initialize the register by conecting this constant. Place a "Build Array" function between shift register's input and output and conect them, using the pop up menu, change the input of the "build array" to "concatenate inputs", resize the function by adding another input.
You can now conect on this new input the singular value you want to add to the array at each new iteration
.
Message 4 of 4
(3,268 Views)