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,325 Views)

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

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

The thing is a mess currently but here it is

Download All
0 Kudos
Message 3 of 11
(5,315 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,302 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,297 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,293 Views)

You might want to look at the Data Queue PtByPt.vi.


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
0 Kudos
Message 7 of 11
(5,289 Views)

I'll check out that VI here soon thanks! As for the shift registar idea I understand how that would save the data however I am not sure that would fix the problem of giving me the last 30 mins when I press a generate report comand. I almost think I would need to have a continual running array getting data at a sample rate x/min and be able to call on the last x amount of data. Im just not sure if that is possible in LabView. 

 

I am able to get a report every 30 mins if I want to, but the user would be constricted to that chunk of data, and if they wanted to stop a test at lets say 45 mins they would only get data from 30-45 min istead of 15-45 min range

0 Kudos
Message 8 of 11
(5,275 Views)
Solution
Accepted by SAMB.

@SAMB. wrote:

I almost think I would need to have a continual running array getting data at a sample rate x/min and be able to call on the last x amount of data. I'm just not sure if that is possible in LabView.


That you can do with a simple Delete From Array.  Just wire in the number of samples into the Length input and you will get the last X samples out of the deleted section output.

 

Of course, doing it this way (continuously growing array) could lead to the unnecessary usage of a lot of memory.


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
0 Kudos
Message 9 of 11
(5,259 Views)

How fast are you collecting data?

 

Can't you just set an array to the size of the amount of data points you want and then let it fill up.  Then, whenever you want the data you can just pull the data from the array and it will be the last 30 minutes worth of data.

 

-Bear

Regards,

Ben Johnson
ʕง•ᴥ•ʔง
0 Kudos
Message 10 of 11
(5,191 Views)