This is a static copy of a profile reportHome
mean (1272 calls, 5.028 sec)
Generated 05-Aug-2011 13:01:00 using cpu time.
function in file /usr/local/MATLAB/R2011a/toolbox/matlab/datafun/mean.m
Copy to new window for comparing multiple runs
Parents (calling functions)
Lines where the most time was spent
Line Number | Code | Calls | Total Time | % Time | Time Plot |
30 | y = sum(x,dim)/size(x,dim); | 209 | 4.481 s | 89.1% |  |
28 | y = sum(x)/size(x,dim); | 1063 | 0.273 s | 5.4% |  |
25 | dim = find(size(x)~=1, 1 ); | 1063 | 0.022 s | 0.4% |  |
31 | end | 209 | 0 s | 0% |  |
29 | else | 209 | 0 s | 0% |  |
All other lines | | | 0.251 s | 5.0% |  |
Totals | | | 5.028 s | 100% | |
Children (called functions)
No childrenCode Analyzer results
No Code Analyzer messages.Coverage results
[ Show coverage for parent directory ]
Total lines in function | 31 |
Non-code lines (comments, blank lines) | 24 |
Code lines (lines that can run) | 7 |
Code lines that did run | 7 |
Code lines that did not run | 0 |
Coverage (did run/can run) | 100.00 % |
Function listing
time calls line
1 function y = mean(x,dim)
2 %MEAN Average or mean value.
3 % For vectors, MEAN(X) is the mean value of the elements in X. For
4 % matrices, MEAN(X) is a row vector containing the mean value of
5 % each column. For N-D arrays, MEAN(X) is the mean value of the
6 % elements along the first non-singleton dimension of X.
7 %
8 % MEAN(X,DIM) takes the mean along the dimension DIM of X.
9 %
10 % Example: If X = [1 2 3; 3 3 6; 4 6 8; 4 7 7];
11 %
12 % then mean(X,1) is [3.0000 4.5000 6.0000] and
13 % mean(X,2) is [2.0000 4.0000 6.0000 6.0000].'
14 %
15 % Class support for input X:
16 % float: double, single
17 %
18 % See also MEDIAN, STD, MIN, MAX, VAR, COV, MODE.
19
20 % Copyright 1984-2009 The MathWorks, Inc.
21 % $Revision: 5.17.4.5 $ $Date: 2010/09/02 13:35:22 $
22
1272 23 if nargin==1,
24 % Determine which dimension SUM will use
0.02 1063 25 dim = find(size(x)~=1, 1 );
1063 26 if isempty(dim), dim = 1; end
27
0.27 1063 28 y = sum(x)/size(x,dim);
209 29 else
4.48 209 30 y = sum(x,dim)/size(x,dim);
209 31 end