|
CELL2MAT Convert the contents of a cell array into a single matrix.
" d1 a. Y& l6 a" V M = CELL2MAT(C) converts a multidimensional cell array with contents of
, q' l A# B9 P the same data type into a single matrix. The contents of C must be able
. A0 |2 |- o, N8 f to concatenate into a hyperrectangle. Moreover, for each pair of
. w9 M! a" Z9 w) v' L ` neighboring cells, the dimensions of the cell's contents must match,
. u" ?9 k( Z4 \ excluding the dimension in which the cells are neighbors. This constraint( T# p+ ~/ W9 D; f. P2 i0 o$ h
must hold true for neighboring cells along all of the cell array's
7 z) H( G+ p. Q) ~$ _, p/ l& ~4 ` dimensions.
: I+ r2 q ^; J4 z& U2 H
1 z* l0 [6 N5 _( N The dimensionality of M, i.e. the number of dimensions of M, will match
8 X9 j) R9 F. }' {0 j the highest dimensionality contained in the cell array.
5 I M0 h( x- @$ r4 ]% ^' E
6 r5 k9 Q4 w6 k$ P/ O$ W CELL2MAT is not supported for cell arrays containing cell arrays or
# t! J( `% B# o) a- W1 z. b objects.
7 v! I7 P* D% l! }
e! j0 w. ]0 x# ] Example:
+ ?; c5 g4 _, ? C = {[1] [2 3 4]; [5; 9] [6 7 8; 10 11 12]};
! F5 Z6 O" p* A: c' m! Z* g M = cell2mat(C); r) q+ ~2 h: n+ Y
3 c. p8 `1 Q/ }9 w/ M" Z/ \/ ? See also mat2cell, num2cell
" ^' I! E) \& k1 g. k. [1 T- ?* s
Overloaded methods:
9 t+ g* A4 x, g4 y% O5 @6 a distributed/cell2mat
3 ^: Y, r7 g0 I0 O6 E
- r4 g- s/ y( s1 ]9 s; a Reference page in Help browser$ y+ ]( i6 P, n' ]) F; V2 \
doc cell2mat; ^3 s1 m; ^8 I$ B1 O8 D& ]
|
|