This is a static copy of a profile report

Home

nanmean (18174 calls, 1.302 sec)
Generated 05-Nov-2014 07:53:52 using cpu time.
function in file /usr1/opt/matlab/7.13/toolbox/stats/stats/nanmean.m
Copy to new window for comparing multiple runs

Parents (calling functions)

Function NameFunction TypeCalls
skewnessfunction18174
Lines where the most time was spent

Line NumberCodeCallsTotal Time% TimeTime Plot
28
n = sum(~nans,dim);
181740.371 s28.5%
31
m = sum(x,dim) ./ n;
181740.220 s16.9%
17
nans = isnan(x);
181740.200 s15.4%
18
x(nans) = 0;
181740.140 s10.8%
29
n(n==0) = NaN; % prevent divid...
181740.090 s6.9%
All other lines  0.280 s21.5%
Totals  1.302 s100% 
Children (called functions)
No children
Code Analyzer results
No Code Analyzer messages.
Coverage results
[ Show coverage for parent directory ]
Total lines in function32
Non-code lines (comments, blank lines)21
Code lines (lines that can run)11
Code lines that did run8
Code lines that did not run3
Coverage (did run/can run)72.73 %
Function listing
   time   calls  line
1 function m = nanmean(x,dim)
2 %NANMEAN Mean value, ignoring NaNs.
3 % M = NANMEAN(X) returns the sample mean of X, treating NaNs as missing
4 % values. For vector input, M is the mean value of the non-NaN elements
5 % in X. For matrix input, M is a row vector containing the mean value of
6 % non-NaN elements in each column. For N-D arrays, NANMEAN operates
7 % along the first non-singleton dimension.
8 %
9 % NANMEAN(X,DIM) takes the mean along dimension DIM of X.
10 %
11 % See also MEAN, NANMEDIAN, NANSTD, NANVAR, NANMIN, NANMAX, NANSUM.
12
13 % Copyright 1993-2004 The MathWorks, Inc.
14 % $Revision: 1.1.8.1 $ $Date: 2010/03/16 00:15:50 $
15
16 % Find NaNs and set them to zero
0.20 18174 17 nans = isnan(x);
0.14 18174 18 x(nans) = 0;
19
0.05 18174 20 if nargin == 1 % let sum deal with figuring out which dimension to use
21 % Count up non-NaNs.
22 n = sum(~nans);
23 n(n==0) = NaN; % prevent divideByZero warnings
24 % Sum up non-NaNs, and divide by the number of non-NaNs.
25 m = sum(x) ./ n;
0.08 18174 26 else
27 % Count up non-NaNs.
0.37 18174 28 n = sum(~nans,dim);
0.09 18174 29 n(n==0) = NaN; % prevent divideByZero warnings
30 % Sum up non-NaNs, and divide by the number of non-NaNs.
0.22 18174 31 m = sum(x,dim) ./ n;
0.06 18174 32 end

Other subfunctions in this file are not included in this listing.