06-04-2013 01:29 PM
I need to average 5 minutes worth of data, save that average, and then start over on the next 5 minutes of data, averaging that block of data. I tried using the pt-by-pt mean function in LabVIEW, but that seems to take a continuous running average, which I do not want. I'll probably be reading the data once every 0.1 seconds, so I can't used stacked shift registers, as that wouldn't be very economical. I've thought about building an array, but I don't know how to pull all the data out at once to average it in an efficient way, plus I'm stuck on the concept of re-setting the array/emptying the array after that five minutes of data has been collected, averaged, and recorded.
Does someone have a suggestion? I'd really appreciate any advice or suggestions on how to go about this.
Solved! Go to Solution.
06-04-2013 01:41 PM
Keep a running sum in a shift register. When your 5 minutes have expired, divide the sum by the number of samples taken, reset the sum, and start over.
06-04-2013 02:13 PM
I think you're hung up on "efficiency." Computers nowadays are so fast and hold so much RAM that summing 3000 numbers using a shift register and averaging them takes approximately no time at all. Even storing the numbers in the array you mention, summing them all at once, and dividing by 3000 would take just a nanosmidgeon more than no time at all. There are threads in this forum that talk about doing math on millions of numbers takes a trivial amount of time. The one thing that does take up time is drawing pictures (graphs, etc.). As long as you don't have to redraw (refresh) an accumulating graph at every data point, you should be all right.
Cameron
06-04-2013 06:05 PM
crossrulz, thank you. That worked great.
02-13-2015 05:29 PM
Hi,
I am having a similar problem and was wondering if you could share your VI that worked? I am new to Labview and am still trying to get used to all the programming.
Thanks!