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

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

[复制链接]

该用户从未签到

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

EDA365欢迎您登录!

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

x
Matlab里怎么把元胞数组的内容转化为矩阵?(元胞数组的每个元胞都是double型的数)。) s# W& I. N6 m6 e; C  h; y0 b

该用户从未签到

2#
发表于 2020-5-8 13:25 | 只看该作者
CELL2MAT Convert the contents of a cell array into a single matrix.3 s# W4 P5 J; b& q4 D8 a: `3 F  `
    M = CELL2MAT(C) converts a multidimensional cell array with contents of5 v& P: W* A& _8 s5 A$ ?' D0 _
    the same data type into a single matrix. The contents of C must be able
  x* n2 t2 _+ @    to concatenate into a hyperrectangle. Moreover, for each pair of1 A: c6 g- a5 [# {
    neighboring cells, the dimensions of the cell's contents must match,9 `0 _5 v1 r  p( W2 Z, g( ~
    excluding the dimension in which the cells are neighbors. This constraint
9 X* Q- t& k* e. I    must hold true for neighboring cells along all of the cell array's
) c3 L. o. F1 [" \5 W4 H5 [1 l$ ^    dimensions.% o( w* O$ f, r9 Y, N5 g% @
9 F( F( T" V4 B7 A# c* U
    The dimensionality of M, i.e. the number of dimensions of M, will match
) ~( x9 k7 Y0 x    the highest dimensionality contained in the cell array.) j. \; q1 j6 Z3 m
$ `* A" T2 V1 q
    CELL2MAT is not supported for cell arrays containing cell arrays or6 u4 O0 c" C( g$ Q: R
    objects.
: C( l7 u2 \% Q. n7 z5 C/ W/ O/ k+ |0 R5 ~2 q0 t3 \# o
        Example:
. V7 z6 A) K7 ~9 i% x3 }! R           C = {[1] [2 3 4]; [5; 9] [6 7 8; 10 11 12]};
" v. H& F7 @8 F6 ~6 l- _) J           M = cell2mat(C)" {$ U+ l1 D' N8 }" w! Q" U
/ ^5 }* r) R: m9 c# z1 X/ P
        See also mat2cell, num2cell
( y9 G+ `' s$ ]; y% [* f$ R* i) L( G0 w: z  g: ]
    Overloaded methods:
2 X+ d3 O7 R, ?" c6 T       distributed/cell2mat9 V# q+ ?3 a, t; C/ }' b
9 K: d% M* y$ I! D, \; ?
    Reference page in Help browser
# c! j4 L$ C3 e; k0 V7 T       doc cell2mat

该用户从未签到

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

! J. Q5 L+ i0 C4 z, H+ }+ jhelp cell2mat

该用户从未签到

4#
发表于 2020-5-8 14:18 | 只看该作者
仔细看下mat2cell命令,不只能转化成1*1的cell。5 q8 u% r3 b* g. _% O: v- T

% U/ w! K+ y! ^$ {n = 10;2 S2 f7 G* K8 U' y" ^
a = rand(n);
+ ^3 m  D# f/ s+ g2 b& U% Vacell = mat2cell(a,ones(n,1),ones(n,1));

该用户从未签到

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

本版积分规则

关闭

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

EDA365公众号

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

GMT+8, 2025-11-24 12:08 , Processed in 0.140625 second(s), 23 queries , Gzip On.

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

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

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