Convert array to cell array with consistently sized cells

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 array`C`

, where each cell contains a 2-by-1 column of`A`

.`num2cell(A,2)`

creates a 2-by-1 cell array`C`

, where each cell contains a 1-by-3 row of`A`

.`num2cell(A,[1 2])`

creates a 1-by-1 cell array`C`

, where the cell contains the entire array`A`

.

Was this topic helpful?