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

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

[复制链接]

该用户从未签到

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

EDA365欢迎您登录!

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

x
Matlab里怎么把元胞数组的内容转化为矩阵?(元胞数组的每个元胞都是double型的数)。: j4 F2 q3 o. q% `/ k* v  J

该用户从未签到

2#
发表于 2020-5-8 13:25 | 只看该作者
CELL2MAT Convert the contents of a cell array into a single matrix.
) A5 t" W5 `# M0 a. h    M = CELL2MAT(C) converts a multidimensional cell array with contents of2 \7 P4 `- L8 Z4 M1 T
    the same data type into a single matrix. The contents of C must be able
# a' w' g8 z2 {. V; R/ i- N    to concatenate into a hyperrectangle. Moreover, for each pair of1 [/ v3 f% e) I5 ?
    neighboring cells, the dimensions of the cell's contents must match,) ]8 a0 I/ i2 P1 V( U
    excluding the dimension in which the cells are neighbors. This constraint
1 L* A  S( ~0 T' S$ R1 d    must hold true for neighboring cells along all of the cell array's
6 i3 c1 a& B, P' f3 D    dimensions.
* D4 l1 f  w6 @. ?2 p1 ?' g
/ ]8 q2 j2 x" K; \) y    The dimensionality of M, i.e. the number of dimensions of M, will match; u/ t  H; Y$ d6 v# M5 v
    the highest dimensionality contained in the cell array.
% G3 T' I2 ]1 o2 [# n  d% L& l3 F. ~5 x4 s! s" z
    CELL2MAT is not supported for cell arrays containing cell arrays or
$ [; J( ^7 s# q0 j( n) k9 ~, w    objects.! H0 a' h  S! x- X

* X( Y6 y  d; L5 H4 \        Example:  z+ _6 W  O5 F
           C = {[1] [2 3 4]; [5; 9] [6 7 8; 10 11 12]};. O/ W" r, `) l8 Q$ z1 i4 _
           M = cell2mat(C)
# w: ^# q$ R8 W7 N' C+ M* u+ `, o# Z1 G' N1 ?- Y8 i1 G( [  z
        See also mat2cell, num2cell, W. H0 L. d8 u( W
: v5 E+ i6 I5 t& W/ ^
    Overloaded methods:. Z5 ]! J4 n3 v' {, J" X: D( G9 o
       distributed/cell2mat
8 B7 @5 o& x. y8 ]3 O6 A
! d# J- z/ h4 k% [" u% t4 S    Reference page in Help browser
+ V$ u- y" R+ ]2 H       doc cell2mat

该用户从未签到

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

" }" P, t, t/ T3 }+ t# {- G5 Ahelp cell2mat

该用户从未签到

4#
发表于 2020-5-8 14:18 | 只看该作者
仔细看下mat2cell命令,不只能转化成1*1的cell。
0 F! o: v5 N, o0 l: C3 x; \. k( p: \3 C- Y
n = 10;! e7 H6 Y# k2 |* ~; K0 _
a = rand(n);. {8 {( D" s1 j+ o$ I; F
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-11-24 16:18 , Processed in 0.203125 second(s), 24 queries , Gzip On.

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

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

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