function avg
Returns the average value of X, optionally omitting a value. Undefined values (INF and NaN) are ignored.
Syntax
result = avg(X [, omit [,/x | /y | /z | /xy | /xz | /yz]])
Arguments
X: | A matrix. |
omit: | A value to be omitted when taking the average. |
Switches
/x: | Calculate the average along the first axis |
/y: | Calculate the average along the second axis |
/z: | Calculate the average along the third axis |
/xy: | Calculate the average along the first and second axes |
/xz: | Calculate the average along the first and third axes |
/yz: | Calculate the average along the second and third axes |
Examples
Find the average of the values 0,1,2,3,4 (which is 2):
print avg([0:4])
Calculate an average image of a 3D cube:
result = avg(cube, /z)
This is the same as:
result = cubeavg(cube)
See also
function max
function min
function total
function median
function stddev
function meddev
function cubeavg
function variance