LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

problem with mean value.

Solved!
Go to solution

Hi, i got problems with the mean value function, to begin with i have a very limited knowledge of labview so this could be a very stupid question. 

The problem is that i want to have the total mean value of a run displayed "online", so that it displays the mean of all readings from a instrument from the moment i start the program and till i turn it off. The things ive tried just seems to take the mean of for example the 10 last values, and as i said, i want it too include all the readings during the whole run that can last for a couple of hours so its alot of measurements.

Would appreciate all the help and tips i can get! Hope i managed to describe the problem, im finding it hard to find the words to use in english.

0 Kudos
Message 1 of 5
(2,843 Views)

It would probably be easier to keep a running total and divide by the number of samples.  This would use much less memory than an array.

 

 

 

>

"There is a God shaped vacuum in the heart of every man which cannot be filled by any created thing, but only by God, the Creator, made known through Jesus." - Blaise Pascal
0 Kudos
Message 2 of 5
(2,831 Views)

Hi robnys,

 

the Mean function from math->probability palette calculates the mean from the given array.

So I would like to ask: what does the array contain you use for data collection?

 

The same applies, when you calculate the average "manually" by summing up the data and dividing by the number of elements...

 

For all other possibilities you should attach a (simplified) VI, that shows your problem!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 3 of 5
(2,830 Views)

If you have the full or professional edition of LabVIEW, you can use Mean PtByPt to calculate a continuous average.


Now is the right time to use %^<%Y-%m-%dT%H:%M:%S%3uZ>T
If you don't hate time zones, you're not a real programmer.

"You are what you don't automate"
Inplaceness is synonymous with insidiousness

0 Kudos
Message 4 of 5
(2,775 Views)
Solution
Accepted by robnys

As Philip proposed, the Mean PtByPt is the appropriate VI for you.  It is located in the Functions Palette, under Signal Processing > PtByPt > Statistics & Probability

 

Attached is an Action Engine that does something similar.  I hesitate to post it because it does it for a single data at a time.  You can change the code to select a single value or to input an array (just get the size of the array and increment the count by the size of the array).  You can do that by adding another case and adding another selection to the enum Ctrl.

 

 

Message 5 of 5
(2,762 Views)