This is a static copy of a profile report

Home

num2cell (5 calls, 0.000 sec)
Generated 15-Mar-2007 12:01:43 using real time.
M-function in file C:\Program Files\MATLAB71\toolbox\matlab\datatypes\num2cell.m
[Copy to new window for comparing multiple runs]

Parents (calling functions)

Function NameFunction TypeCalls
menu>local_GUImenuM-subfunction5
Lines where the most time was spent

Line NumberCodeCallsTotal Time% TimeTime Plot
43
rdims(dims) = []; % Remaining ...
50.000 s65.0%
42
rdims = 1:max(ndims(a),max(dim...
50.000 s16.8%
46
bsize = siz;
50.000 s7.2%
50
csize = siz;
50.000 s6.4%
51
csize(dims) = 1; % Set selecte...
50.000 s4.7%
Other lines & overhead  0 s0%
Totals  0.000 s100% 
Children (called functions)
No children
M-Lint results
No M-Lint messages.
Coverage results
[ Show coverage for parent directory ]
Total lines in file62
Non-code lines (comments, blank lines)34
Code lines (lines that can run)28
Code lines that did run17
Code lines that did not run11
Coverage (did run/can run)60.71 %
Function listing
   time   calls  line
1 function c = num2cell(a,dims)
2 %NUM2CELL Convert numeric array into cell array.
3 % C = NUM2CELL(A) converts the array A into a cell array by
4 % placing each element of A into a separate cell. C will
5 % be the same size as A.
6 %
7 % C = NUM2CELL(A,DIMS) converts the array A into a cell array by
8 % placing the dimensions specified by DIMS into separate cells.
9 % C will be the same size as A except that the dimensions matching
10 % DIMS will be 1. For example, NUM2CELL(A,2) places the rows of A
11 % into separate cells. Similarly NUM2CELL(A,[1 3]) places the
12 % column-depth pages of A into separate cells.
13 %
14 % NUM2CELL works for all array types.
15 %
16 % Use CELL2MAT or CAT(DIM,C{:}) to convert back.
17 %
18 % See also MAT2CELL, CELL2MAT
19
20 % Clay M. Thompson 3-15-94
21 % Copyright 1984-2003 The MathWorks, Inc.
22 % $Revision: 1.18.4.2 $ $Date: 2004/04/10 23:25:30 $
5 23 if nargin<1
24 error(nargchk(1,2,nargin));
25 end
5 26 if isempty(a)
27 c = {};
28 return
29 end
5 30 if nargin==1
31 c = cell(size(a));
32 for i=1:numel(a)
33 c{i} = a(i);
34 end
35 return
36 end
37
38 % Size of input array
5 39 siz = [size(a),ones(1,max(dims)-ndims(a))];
40
41 % Create remaining dimensions vector
< 0.01 5 42 rdims = 1:max(ndims(a),max(dims));
< 0.01 5 43 rdims(dims) = []; % Remaining dims
44
45 % Size of extracted subarray
< 0.01 5 46 bsize = siz;
5 47 bsize(rdims) = 1; % Set remaining dimensions to 1
48
49 % Size of output cell
< 0.01 5 50 csize = siz;
< 0.01 5 51 csize(dims) = 1; % Set selected dimensions to 1
5 52 c = cell(csize);
53
54 % Permute A so that requested dims are the first few dimensions
5 55 a = permute(a,[dims rdims]);
56
57 % Make offset and index into a
5 58 offset = prod(bsize);
5 59 ndx = 1:prod(bsize);
5 60 for i=0:prod(csize)-1,
12 61 c{i+1} = reshape(a(ndx+i*offset),bsize);
12 62 end