This is a static copy of a profile reportHome
nansum (1 call, 0.000 sec)
Generated 05-Aug-2011 13:03:53 using cpu time.
function in file /usr/local/MATLAB/R2011a/toolbox/stats/stats/nansum.m
Copy to new window for comparing multiple runs
Parents (calling functions)
Function Name | Function Type | Calls |
nanvar | function | 1 |
Lines where the most time was spent
No measurable time spent in this functionLine Number | Code | Calls | Total Time | % Time | Time Plot |
23 | end | 1 | 0 s | 0% |  |
22 | y = sum(x,dim); | 1 | 0 s | 0% |  |
21 | else % work along th... | 1 | 0 s | 0% |  |
19 | if nargin == 1 % let sum figur... | 1 | 0 s | 0% |  |
18 | x(isnan(x)) = 0; | 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 | 23 |
Non-code lines (comments, blank lines) | 17 |
Code lines (lines that can run) | 6 |
Code lines that did run | 5 |
Code lines that did not run | 1 |
Coverage (did run/can run) | 83.33 % |
Function listing
time calls line
1 function y = nansum(x,dim)
2 %NANSUM Sum, ignoring NaNs.
3 % Y = NANSUM(X) returns the sum of X, treating NaNs as missing values.
4 % For vector input, Y is the sum of the non-NaN elements in X. For
5 % matrix input, Y is a row vector containing the sum of non-NaN elements
6 % in each column. For N-D arrays, NANSUM operates along the first
7 % non-singleton dimension.
8 %
9 % Y = NANSUM(X,DIM) takes the sum along dimension DIM of X.
10 %
11 % See also SUM, NANMEAN, NANVAR, NANSTD, NANMIN, NANMAX, NANMEDIAN.
12
13 % Copyright 1993-2004 The MathWorks, Inc.
14 % $Revision: 1.1.8.1 $ $Date: 2010/03/16 00:15:54 $
15
16 % Find NaNs and set them to zero. Then sum up non-NaNs. Cols of all NaNs
17 % will return zero.
1 18 x(isnan(x)) = 0;
1 19 if nargin == 1 % let sum figure out which dimension to work along
20 y = sum(x);
1 21 else % work along the explicitly given dimension
1 22 y = sum(x,dim);
1 23 end