LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how do you average an array

If you have an arrray of numbers that is being outputed, how do you average the array
0 Kudos
Message 1 of 4
(3,356 Views)
I don't know if there is some specific vi for this, but you can sum all the components using "Add array elements" under numeric palette, and then divide by array size, which you can get with the vi under array function palette.
Hope this helps
0 Kudos
Message 2 of 4
(3,356 Views)
You can use Mean.vi found in Mathematics >> Probability and Statistics palette.
I hope this function is included in base version of labview too.
Roberto


Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 3 of 4
(3,356 Views)
Both the Mean.vi function mentioned by Roberto and the Add Array Elements method suggested by Gorka works just fine for calculationg the average of numbers in an array if your data consists of real numbers. However, if you are dealing with complex numbers you should consider the latter method since the Mean.vi function is not compatible with complex numbers. In other words, if you wire an array of complex numbers to Mean.vi you get the mean value for the real parts only. However, the same array wired to an Add Array Elements followed by a division of the array dimension, as suggested by Gorka, will result in the complex mean value. /Mikael
0 Kudos
Message 4 of 4
(3,356 Views)