1
function [m]=nanmean(x,orient)
3
//This function returns in scalar m the mean of the values (ignoring the
4
//NANs) of a vector or matrix x.
6
//For a vector or matrix x, m=nanmean(x) or m=nanmean(x,'*')
7
//returns in scalar m the mean of all the entries (ignoring the NANs) of
10
//m=nanmean(x,'r') (or, equivalently, m=nanmean(x,1)) returns in
11
//each entry of the row vector m of type 1xsize(x,'c') the mean of
12
//each column of x (ignoring the NANs).
14
//m=nanmeanf(x,'c')(or, equivalently, m=nanmean(x,2)) returns in
15
//each entry of the column vector m of type size(x,'c')x1 the mean of
16
//each row of x (ignoring the NANs).
18
//author: carlos klimann
22
if argn(2)==0 then error('nanmean requires one or two inputs.'), end
23
if argn(2)==1 then orient='*',end
28
N=size(x,orient)-sum(bool2s(isn),orient)