找回密码
 注册
关于网站域名变更的通知
查看: 3063|回复: 7
打印 上一主题 下一主题

请问Matlab怎样把元胞数组转化成矩阵?

[复制链接]

该用户从未签到

跳转到指定楼层
1#
发表于 2020-5-8 10:38 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

EDA365欢迎您登录!

您需要 登录 才可以下载或查看,没有帐号?注册

x
Matlab里怎么把元胞数组的内容转化为矩阵?(元胞数组的每个元胞都是double型的数)。7 `3 K; [7 K( z" A4 }5 n

该用户从未签到

2#
发表于 2020-5-8 13:25 | 只看该作者
CELL2MAT Convert the contents of a cell array into a single matrix.% D: I. B$ S% ?$ ~, u
    M = CELL2MAT(C) converts a multidimensional cell array with contents of
0 c& w) Q! @6 X    the same data type into a single matrix. The contents of C must be able
% q  r! A8 \( {    to concatenate into a hyperrectangle. Moreover, for each pair of. n1 D7 V6 q) T
    neighboring cells, the dimensions of the cell's contents must match,
) g7 c7 c9 K. Y  u0 h0 M/ A    excluding the dimension in which the cells are neighbors. This constraint
( F% I" ]5 t: i' y+ e, k    must hold true for neighboring cells along all of the cell array's+ P; G$ d6 M9 [/ P
    dimensions.- ^+ Y2 H. z- `0 K. J" F' Y! S
- P/ [! y) R% H: B- {
    The dimensionality of M, i.e. the number of dimensions of M, will match
" N+ l4 N: e# j$ e" H    the highest dimensionality contained in the cell array.
* f9 h  I2 o) \- P# T/ b
: X/ ^% `9 F" y# V. V0 a    CELL2MAT is not supported for cell arrays containing cell arrays or* a+ b2 N5 S. @
    objects.7 [9 t% ~+ t0 u) }; c

, h2 S: }2 ]! t7 f) t) [  @        Example:2 g. W9 }% X$ V3 L
           C = {[1] [2 3 4]; [5; 9] [6 7 8; 10 11 12]};
- i) @5 s& w) L: ~           M = cell2mat(C)6 a% }! h: g5 \0 N; K
) I7 T. w& w2 f* I  V9 {
        See also mat2cell, num2cell
; o8 ]$ P' N! ?" [2 `
1 R2 B& y2 i" C    Overloaded methods:, @) L* l! }* t2 t0 Q& b3 H$ w; I0 P
       distributed/cell2mat# ^& J( T: M% s/ k2 T

5 v: }) E  d2 T; |3 t% p    Reference page in Help browser
( H4 ]! @9 K- _0 ~  t: |       doc cell2mat

该用户从未签到

3#
发表于 2020-5-8 13:25 | 只看该作者

) P& j9 u$ J( j4 shelp cell2mat

该用户从未签到

4#
发表于 2020-5-8 14:18 | 只看该作者
仔细看下mat2cell命令,不只能转化成1*1的cell。6 H! I' a/ @  {9 H/ J5 F4 V. h3 Q

# \# s* o; o( f8 T9 cn = 10;
' a" H9 W9 D& Q1 `7 L( ca = rand(n);% U: v& ~& r, T- d" H% Y, J/ R
acell = mat2cell(a,ones(n,1),ones(n,1));

该用户从未签到

5#
发表于 2020-5-8 17:20 | 只看该作者
有问题就找help
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关闭

推荐内容上一条 /1 下一条

EDA365公众号

关于我们|手机版|EDA365电子论坛网 ( 粤ICP备18020198号-1 )

GMT+8, 2025-8-23 23:49 , Processed in 0.109375 second(s), 23 queries , Gzip On.

深圳市墨知创新科技有限公司

地址:深圳市南山区科技生态园2栋A座805 电话:19926409050

快速回复 返回顶部 返回列表