num2cell
Convert array to cell array with consistently sized cells
Description
splits
the contents of C
= num2cell(A
,dim
)A
into separate cells of C
,
where dim
specifies which dimensions of A
to
include in each cell. dim
can be a scalar or
a vector of dimensions. For example, if A
has
2 rows and 3 columns, then:
num2cell(A,1)
creates a 1-by-3 cell arrayC
, where each cell contains a 2-by-1 column ofA
.num2cell(A,2)
creates a 2-by-1 cell arrayC
, where each cell contains a 1-by-3 row ofA
.num2cell(A,[1 2])
creates a 1-by-1 cell arrayC
, where the cell contains the entire arrayA
.
Examples
Input Arguments
Output Arguments
Tips
Extended Capabilities
Version History
Introduced before R2006a