LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Array Function Data Collection

Solved!
Go to solution
Hey all,

Does anyone know a method to only collect the last x amount of point of data in an array. To elaborate on what I am doing.. I want to be able to generate a spreadsheet using an array method of collection (for mathematical manipulations), and at any point click a control that lets me generate the last 30 mins worth of data. I am able to set it up using  a for loop easily to the point that if I prompt it to collect x amount of data before starting the test I can get 30 mins worth but can't seem to pinpoint a method to do the "at any time" report generation.

What I was thinking would be a solution was to set a restriction of the amount of cells an array has.. lets say 30 as an example. When it fills the 30 cells up the next point of data populates the top cell while removing the bottom cell, essentially shifting the array down one and populating the top. I thought of making an array constant on the front diagram but that just seems to control the indicator and not the entire data set going to the Write to Spreadsheet function.

Maybe I just didn't test out a method well enough? I have about 40 different arrays going into a build array function to allow me to manipulate the data correctly so I am not sure if using the index array will let me acheive this or will only let me get the first n amount of arrays going into the build array.

Thanks,
Sam

 

 
0 Kudos
Message 1 of 11
(5,480 Views)

Could you post an example of what you have so far?

-ncm
0 Kudos
Message 2 of 11
(5,476 Views)

The thing is a mess currently but here it is

Download All
0 Kudos
Message 3 of 11
(5,470 Views)
Does the current vi that you are using collect the last 30 minutes worth of data that you need? You can do a loop where the condition to stop is when you press a 'stop' button and then the last 30 minutes worth of data would be saved if you pull out the 'save to spreadsheet' out of the loop.
-ncm
0 Kudos
Message 4 of 11
(5,457 Views)

Currently I can set the amount of time the data is collected to 30 mins or any other method based on the sample rate and using a loop count function on the for loop. I need to collect data every 20 secs so this seems to work nicely. As for the while loop I was thinking of that, however I am not sure how I'd be able to pull out just the last 30 mins worth of data at any point throughout the test.

0 Kudos
Message 5 of 11
(5,452 Views)
Using shift registers instead of tunnels for the loops will keep the information for each iteration instead of just passing the most current value. You can build your array and loop with that.
-ncm
0 Kudos
Message 6 of 11
(5,448 Views)