03-31-2015 01:13 PM
Hello,
I am trying to have my program continuously store the last several minutes of data my sensor collects and run a computation to see if a certain fraction of it is over a threshold. From what I know, I could store the values in shift registers, but I am storing over a hundred thousand values and that is going to get to clunky on my block diagram and was wondering what better ways there were to store these values.
Thank you for your time.
Solved! Go to Solution.
03-31-2015 01:24 PM
03-31-2015 01:27 PM
I would store all of the data in a binary file. But I would also process the data on the fly so that I would not need all of those data points in memory. It sounds like you just need # points above a threshold and the # of points acquired. So that would be 2 shift registers.
03-31-2015 01:33 PM - edited 03-31-2015 01:34 PM
@Dennis_Knutson
When they do it in the tutorial they extend the left shift register to five elements to record the last five values, so if I have to drag the shift register out 100000+ values I'm worried it'll be way to big and clunky on the block diagram to work with. I'm also not sure how I would count out that I have the exact number of blocks other than doing it slowly and counting them out as I drag the shift register out.
03-31-2015 01:36 PM
@endlessOranges wrote:
When they do it in the tutorial they extend the left shift register to five elements to record the last five values, so if I have to drag the shift register out 100000+ values I'm worried it'll be way to big and clunky on the block diagram to work with. I'm also not sure how I would count out that I have the exact number of blocks other than doing it slowly and counting them out as I drag the shift register out.
The alternative to that would be to store an array of values in the shift register. But that can get really slow if you are constantly building an array.
03-31-2015 01:40 PM - edited 03-31-2015 01:43 PM
@crossrulz wrote:
It sounds like you just need # points above a threshold and the # of points acquired. So that would be 2 shift registers.
I agree, all you need is two scalar shift registers for the two counts. Increment whenever new data arrives. Do you need to do anything else with the raw data?
A few hundred thousand points is not that much and can easily be handled by any modern computer. You have several orders of magnitude more ram!! In any case, if you need to store all data, a shift regsiter with an array of constant size is one of the most efficient data structures and, if done right, operates in-place. Do you know the final number of points before the acquisition starts? Nothing clunky about it. 😄
03-31-2015 01:43 PM - edited 03-31-2015 01:45 PM
Data Queue Pt by Pt. Would also be a good choice (Basically Christian's idea implemented well)
03-31-2015 01:47 PM
03-31-2015 02:04 PM
The sensor should be taking samples at a 1 kHz frequency and I want to store the last 593287 values. I'm looking into arrays storing the values into the shift register but I'm again fairly new with programming in this and struggling to find a way that doesn't also involve manually dragging out a lot of boxes to specify each index in the array to store values into.
03-31-2015 02:15 PM
@endlessOranges wrote:
The sensor should be taking samples at a 1 kHz frequency and I want to store the last 593287 values. I'm looking into arrays storing the values into the shift register but I'm again fairly new with programming in this and struggling to find a way that doesn't also involve manually dragging out a lot of boxes to specify each index in the array to store values into.
Just use the Data Queue PtByPt function. It does all you want.