This is a static copy of a profile report

Home

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)

Function NameFunction TypeCalls
region_seg>get_curvaturesubfunction234500
ml_findobjsfunction421
strel>strel.getneighborssubfunction73932
Lines where the most time was spent

Line NumberCodeCallsTotal Time% TimeTime Plot
35
vi = rem(ndx-1, k(i)) + 1;    ...
618127175.463 s69.5%
36
vj = (ndx - vi)/k(i) + 1; 
61812731.984 s12.7%
37
varargout{i} = vj; 
61812710.454 s4.1%
28
siz = [siz ones(1,nout-length(...
3088537.050 s2.8%
33
k = [1 cumprod(siz(1:end-1))];
3088534.857 s1.9%
All other lines  22.511 s8.9%
Totals  252.319 s100% 
Children (called functions)
No children
Code Analyzer results
No Code Analyzer messages.
Coverage results
[ Show coverage for parent directory ]
Total lines in function39
Non-code lines (comments, blank lines)24
Code lines (lines that can run)15
Code lines that did run12
Code lines that did not run3
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