This is a static copy of a profile reportHome
num2cell (2 calls, 0.000 sec)
Generated 05-Nov-2014 07:53:56 using cpu time.
function in file /usr1/opt/matlab/7.13/toolbox/matlab/datatypes/num2cell.m
Copy to new window for comparing multiple runs
Parents (calling functions)
Function Name | Function Type | Calls |
ppual | function | 2 |
Lines where the most time was spent
No measurable time spent in this functionLine Number | Code | Calls | Total Time | % Time | Time Plot |
69 | end | 6 | 0 s | 0% |  |
68 | c{i+1} = reshape(a(ndx+i*offse... | 6 | 0 s | 0% |  |
67 | for i=0:prod(csize)-1, | 2 | 0 s | 0% |  |
66 | ndx = 1:prod(bsize); | 2 | 0 s | 0% |  |
65 | offset = prod(bsize); | 2 | 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 | 69 |
Non-code lines (comments, blank lines) | 43 |
Code lines (lines that can run) | 26 |
Code lines that did run | 17 |
Code lines that did not run | 9 |
Coverage (did run/can run) | 65.38 % |
Function listing
time calls line
1 function c = num2cell(a,dims)
2 %NUM2CELL Convert numeric array into cell array.
3 % C = NUM2CELL(A) converts numeric array A into cell array C by placing
4 % each element of A into a separate cell in C. The output array has the
5 % same size and dimensions as the input array. Each cell in C contains
6 % the same numeric value as its respective element in A.
7 %
8 % C = NUM2CELL(A, DIM) converts numeric array A into a cell array of
9 % numeric vectors, the dimensions of which depend on the value of the DIM
10 % argument. Return value C contains NUMEL(A)/SIZE(A,DIM) vectors, each of
11 % length SIZE(A, DIM). The DIM input must be an integer with a value from
12 % NDIMS(A) to 1.
13 %
14 % C = NUM2CELL(A, [DIM1, DIM2, ...]) converts numeric array A into a cell
15 % array of numeric arrays, the dimensions of which depend on the values
16 % of arguments [DIM1, DIM2, ...]. Given the variables X and Y, where
17 % X=SIZE(A,DIM1) and Y=SIZE(A,DIM2), return value C contains
18 % NUMEL(A)/PROD(X,Y,...) arrays, each of size X-by-Y-by-.... All DIMn
19 % inputs must be an integer with a value from NDIMS(A) to 1.
20 %
21 % NUM2CELL works for all array types.
22 %
23 % Use CELL2MAT or CAT(DIM,C{:}) to convert back.
24 %
25 % See also MAT2CELL, CELL2MAT
26
27 % Clay M. Thompson 3-15-94
28 % Copyright 1984-2008 The MathWorks, Inc.
29 % $Revision: 1.18.4.5 $ $Date: 2008/12/29 02:10:31 $
30
2 31 error(nargchk(1,2,nargin,'struct'));
32
2 33 if isempty(a)
34 c = {};
35 return
36 end
2 37 if nargin==1
38 c = cell(size(a));
39 for i=1:numel(a)
40 c{i} = a(i);
41 end
42 return
43 end
44
45 % Size of input array
2 46 siz = [size(a),ones(1,max(dims)-ndims(a))];
47
48 % Create remaining dimensions vector
2 49 rdims = 1:max(ndims(a),max(dims));
2 50 rdims(dims) = []; % Remaining dims
51
52 % Size of extracted subarray
2 53 bsize = siz;
2 54 bsize(rdims) = 1; % Set remaining dimensions to 1
55
56 % Size of output cell
2 57 csize = siz;
2 58 csize(dims) = 1; % Set selected dimensions to 1
2 59 c = cell(csize);
60
61 % Permute A so that requested dims are the first few dimensions
2 62 a = permute(a,[dims rdims]);
63
64 % Make offset and index into a
2 65 offset = prod(bsize);
2 66 ndx = 1:prod(bsize);
2 67 for i=0:prod(csize)-1,
6 68 c{i+1} = reshape(a(ndx+i*offset),bsize);
6 69 end