标题: 请问Matlab怎样把元胞数组转化成矩阵? [打印本页] 作者: lupkpu9 时间: 2020-5-8 10:38 标题: 请问Matlab怎样把元胞数组转化成矩阵? Matlab里怎么把元胞数组的内容转化为矩阵?(元胞数组的每个元胞都是double型的数)。" A0 M2 m7 r: M+ P# ? 作者: NNNei256 时间: 2020-5-8 13:25
CELL2MAT Convert the contents of a cell array into a single matrix. & g# k9 z- v# ^ M = CELL2MAT(C) converts a multidimensional cell array with contents of; _$ w3 _ M" Y
the same data type into a single matrix. The contents of C must be able ; d1 [0 W; m% i+ q j, `8 \ to concatenate into a hyperrectangle. Moreover, for each pair of / f9 Q2 a8 \, j, e# t+ a9 r neighboring cells, the dimensions of the cell's contents must match, 7 C( S' q/ J0 P# ? excluding the dimension in which the cells are neighbors. This constraint, h# r9 Y5 ^4 g% S5 J
must hold true for neighboring cells along all of the cell array's G) u- F# q& I: U" M: q dimensions. 1 {, h G/ `8 i7 h: f. d3 X ) a2 S" s" B! n4 v The dimensionality of M, i.e. the number of dimensions of M, will match 2 n$ g, w! X# C/ Q) O/ y the highest dimensionality contained in the cell array. 2 v7 N6 Y5 l2 N$ r$ [3 u. ~. [8 L) o3 F: t4 W3 J+ e
CELL2MAT is not supported for cell arrays containing cell arrays or; B$ |# [: h. P7 \' _; N5 ^' ]' g
objects. 3 S k0 u1 s3 K0 n* D5 j) W$ A& Z: P& t, u) }/ s
Example:2 B+ |9 A/ Y0 g4 p8 |$ T
C = {[1] [2 3 4]; [5; 9] [6 7 8; 10 11 12]}; 1 Z& v, l9 q: p: ` M = cell2mat(C)0 x9 K F6 s# C6 N" X$ G
+ P2 ^; T0 T) Q. ]% @
See also mat2cell, num2cell - a! T K' g/ `4 w( A1 {1 g* {3 |" j2 ^ m) h& S+ n x
Overloaded methods: : b/ F- L, R/ R& a% s m, r! T distributed/cell2mat0 R& U$ ?9 Q; O5 C& J O! C
# x8 ^5 L1 P" X' k' f5 p* R
Reference page in Help browser " }' Y' I% e5 o5 n# b doc cell2mat作者: SsaaM7 时间: 2020-5-8 13:25
) o" Q8 H) g; d2 U1 F4 O3 z
help cell2mat作者: pcbwenrou 时间: 2020-5-8 14:18
仔细看下mat2cell命令,不只能转化成1*1的cell。 . u8 e/ ?% F" t ) v& N& A; G# i# J( Mn = 10;6 @+ ?( l6 Z/ E
a = rand(n);7 {& D; O9 M5 a s# B9 g
acell = mat2cell(a,ones(n,1),ones(n,1));作者: xiaogegepcb 时间: 2020-5-8 17:20
有问题就找help作者: CCxiaom 时间: 2020-5-9 13:24
2楼好厉害作者: yin123 时间: 2020-5-9 14:43
学习学习作者: NingW 时间: 2020-5-11 15:25
看看哈