LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

averaging 5 minutes of data--not running average

Solved!
Go to solution

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. 

0 Kudos
Message 1 of 5
(2,503 Views)
Solution
Accepted by WyoEng

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.


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
Message 2 of 5
(2,500 Views)

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

 

To err is human, but to really foul it up requires a computer.
The optimist believes we are in the best of all possible worlds - the pessimist fears this is true.
Profanity is the one language all programmers know best.
An expert is someone who has made all the possible mistakes.

To learn something about LabVIEW at no extra cost, work the online LabVIEW tutorial(s):

LabVIEW Unit 1 - Getting Started</ a>
Learn to Use LabVIEW with MyDAQ</ a>
0 Kudos
Message 3 of 5
(2,490 Views)

crossrulz, thank you.  That worked great.

0 Kudos
Message 4 of 5
(2,471 Views)

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!

0 Kudos
Message 5 of 5
(2,264 Views)