|
|
CELL2MAT Convert the contents of a cell array into a single matrix.
2 ]2 b) N& O8 R6 A M = CELL2MAT(C) converts a multidimensional cell array with contents of
$ L2 L1 K7 s, v- ` the same data type into a single matrix. The contents of C must be able
# w) E6 v2 C& W! |7 M; | to concatenate into a hyperrectangle. Moreover, for each pair of
3 o D' L6 a2 y% V4 m/ k neighboring cells, the dimensions of the cell's contents must match,# Z* p, L8 \% o/ \, ^
excluding the dimension in which the cells are neighbors. This constraint
9 E4 I9 t& R5 r. E must hold true for neighboring cells along all of the cell array's4 }5 @! F) u' C
dimensions.
: H) [, E* o4 X1 q) g5 L! O5 n! W' ~( s' S* b
The dimensionality of M, i.e. the number of dimensions of M, will match' S8 p+ N6 t* j" N! m
the highest dimensionality contained in the cell array.' f) r" e, y' F1 N
. F0 p4 r9 j4 f! K3 z/ [ CELL2MAT is not supported for cell arrays containing cell arrays or
/ N& l6 R& M1 I' d objects.
( Y* e, D0 I1 R
& x: K: R- d+ l$ V$ |" c Example:1 F* D4 T9 N& {* L0 ?0 ^) ?2 [$ J
C = {[1] [2 3 4]; [5; 9] [6 7 8; 10 11 12]};
" p6 J4 C+ v/ [- _. L; p. ^- W" D7 U M = cell2mat(C)% P/ N, m2 B! j
: X" q$ ^+ T b+ H( I
See also mat2cell, num2cell
6 V8 \, ~8 \/ h% W; F% r+ b# f9 ~' C6 E$ h+ p! @/ m; Q4 Y
Overloaded methods:
- O0 b# q; m% C! S: a, D- ~- _, Z distributed/cell2mat9 G) F1 J; Z4 m- ^
# d3 Q n7 ~) z3 ]" j Reference page in Help browser, {; e' n; O7 y: e: V; W
doc cell2mat
2 u9 \3 M5 ]+ z: {4 w" f9 z |
|