This is a static copy of a profile reportHome
ind2sub (308853 calls, 252.319 sec)
Generated 05-Nov-2014 07:52:52 using cpu time.
function in file /usr1/opt/matlab/7.13/toolbox/matlab/elmat/ind2sub.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 |
35 | vi = rem(ndx-1, k(i)) + 1; ... | 618127 | 175.463 s | 69.5% |  |
36 | vj = (ndx - vi)/k(i) + 1; | 618127 | 31.984 s | 12.7% |  |
37 | varargout{i} = vj; | 618127 | 10.454 s | 4.1% |  |
28 | siz = [siz ones(1,nout-length(... | 308853 | 7.050 s | 2.8% |  |
33 | k = [1 cumprod(siz(1:end-1))]; | 308853 | 4.857 s | 1.9% |  |
All other lines | | | 22.511 s | 8.9% |  |
Totals | | | 252.319 s | 100% | |
Children (called functions)
No childrenCode Analyzer results
No Code Analyzer messages.Coverage results
[ Show coverage for parent directory ]
Total lines in function | 39 |
Non-code lines (comments, blank lines) | 24 |
Code lines (lines that can run) | 15 |
Code lines that did run | 12 |
Code lines that did not run | 3 |
Coverage (did run/can run) | 80.00 % |
Function listing
time calls line
1 function varargout = ind2sub(siz,ndx)
2 %IND2SUB Multiple subscripts from linear index.
3 % IND2SUB is used to determine the equivalent subscript values
4 % corresponding to a given single index into an array.
5 %
6 % [I,J] = IND2SUB(SIZ,IND) returns the arrays I and J containing the
7 % equivalent row and column subscripts corresponding to the index
8 % matrix IND for a matrix of size SIZ.
9 % For matrices, [I,J] = IND2SUB(SIZE(A),FIND(A>5)) returns the same
10 % values as [I,J] = FIND(A>5).
11 %
12 % [I1,I2,I3,...,In] = IND2SUB(SIZ,IND) returns N subscript arrays
13 % I1,I2,..,In containing the equivalent N-D array subscripts
14 % equivalent to IND for an array of size SIZ.
15 %
16 % Class support for input IND:
17 % float: double, single
18 %
19 % See also SUB2IND, FIND.
20
21 % Copyright 1984-2008 The MathWorks, Inc.
22 % $Revision: 1.13.4.4 $ $Date: 2008/05/23 15:34:40 $
23
1.16 308853 24 nout = max(nargout,1);
0.87 308853 25 siz = double(siz);
26
2.43 308853 27 if length(siz)<=nout,
7.05 308853 28 siz = [siz ones(1,nout-length(siz))];
29 else
30 siz = [siz(1:nout-1) prod(siz(nout:end))];
31 end
1.00 308853 32 n = length(siz);
4.86 308853 33 k = [1 cumprod(siz(1:end-1))];
1.55 308853 34 for i = n:-1:1,
175.46 618127 35 vi = rem(ndx-1, k(i)) + 1;
31.98 618127 36 vj = (ndx - vi)/k(i) + 1;
10.45 618127 37 varargout{i} = vj;
3.98 618127 38 ndx = vi;
4.11 618127 39 end