This is a static copy of a profile reportHome
nanmean (86 calls, 0.000 sec)
Generated 05-Aug-2011 13:03:51 using cpu time.
function in file /usr/local/MATLAB/R2011a/toolbox/stats/stats/nanmean.m
Copy to new window for comparing multiple runs
Parents (calling functions)
Lines where the most time was spent
No measurable time spent in this functionLine Number | Code | Calls | Total Time | % Time | Time Plot |
32 | end | 1 | 0 s | 0% |  |
31 | m = sum(x,dim) ./ n; | 1 | 0 s | 0% |  |
29 | n(n==0) = NaN; % prevent divid... | 1 | 0 s | 0% |  |
28 | n = sum(~nans,dim); | 1 | 0 s | 0% |  |
26 | else | 1 | 0 s | 0% |  |
All other lines | | | 0 s | 0% |  |
Totals | | | 0 s | 0% | |
Children (called functions)
No childrenCode Analyzer results
No Code Analyzer messages.Coverage results
[ Show coverage for parent directory ]
Total lines in function | 32 |
Non-code lines (comments, blank lines) | 21 |
Code lines (lines that can run) | 11 |
Code lines that did run | 11 |
Code lines that did not run | 0 |
Coverage (did run/can run) | 100.00 % |
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
86 17 nans = isnan(x);
86 18 x(nans) = 0;
19
86 20 if nargin == 1 % let sum deal with figuring out which dimension to use
21 % Count up non-NaNs.
85 22 n = sum(~nans);
85 23 n(n==0) = NaN; % prevent divideByZero warnings
24 % Sum up non-NaNs, and divide by the number of non-NaNs.
85 25 m = sum(x) ./ n;
1 26 else
27 % Count up non-NaNs.
1 28 n = sum(~nans,dim);
1 29 n(n==0) = NaN; % prevent divideByZero warnings
30 % Sum up non-NaNs, and divide by the number of non-NaNs.
1 31 m = sum(x,dim) ./ n;
1 32 end
Other subfunctions in this file are not included in this listing.