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

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

[复制链接]

该用户从未签到

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

EDA365欢迎您登录!

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

x
Matlab里怎么把元胞数组的内容转化为矩阵?(元胞数组的每个元胞都是double型的数)。
  v' k9 ]% b: E2 r* D

该用户从未签到

2#
发表于 2020-5-8 13:25 | 只看该作者
CELL2MAT Convert the contents of a cell array into a single matrix.
' ~1 T) a4 n* B$ E  l* D: }) T- [    M = CELL2MAT(C) converts a multidimensional cell array with contents of
# X8 b! x! R8 S1 b% [2 E    the same data type into a single matrix. The contents of C must be able
! S! n0 S  K, ~- g7 q    to concatenate into a hyperrectangle. Moreover, for each pair of
" Z5 `0 Y) W1 K% z5 d4 E- l    neighboring cells, the dimensions of the cell's contents must match,
2 \! E7 h+ I. i: O    excluding the dimension in which the cells are neighbors. This constraint
1 Z6 S! I' G, w; j/ j) c. H9 [2 L$ U    must hold true for neighboring cells along all of the cell array's
1 W4 j. V0 z: r7 J    dimensions.
1 l7 W/ E" x. R6 t: X0 @4 W/ G1 G& o9 @! U3 z+ z) [
    The dimensionality of M, i.e. the number of dimensions of M, will match
' G% J. x" X8 h) n0 V) V- [( i7 @    the highest dimensionality contained in the cell array.
; V& c! b7 L9 r3 c. @, P: C6 p4 u5 U. F% K
    CELL2MAT is not supported for cell arrays containing cell arrays or
3 w* a. e0 s6 l8 }; @    objects.
. J2 [! B  R4 V7 E% U) s( x, |* ^  r6 E- q2 W
        Example:
0 n  b  X0 G2 h" E: r) f           C = {[1] [2 3 4]; [5; 9] [6 7 8; 10 11 12]};! J; s  X3 a/ g# W$ J
           M = cell2mat(C)! B4 V# L% L- u5 o8 o8 J$ b& `

. w! o3 Y1 t2 e$ ]# _. Y, p' l: Y        See also mat2cell, num2cell
% m1 [" T8 D! I! e1 N% E* t8 G' X. I3 i4 J
    Overloaded methods:
3 X5 [" {% U3 g1 l' R       distributed/cell2mat9 v6 H9 ]3 Z% N0 h+ u; _
3 i$ E! C; J% e8 Z
    Reference page in Help browser( I- B; `$ t2 Q' h" `) }
       doc cell2mat

该用户从未签到

3#
发表于 2020-5-8 13:25 | 只看该作者
$ a" k9 [, k* ~2 {# a, y
help cell2mat

该用户从未签到

4#
发表于 2020-5-8 14:18 | 只看该作者
仔细看下mat2cell命令,不只能转化成1*1的cell。
' j) ^3 Q& h& n3 N  ^- S2 e
. z) H# E4 o1 L. o- O' ]6 Wn = 10;7 f8 M/ p9 @2 k2 f
a = rand(n);
$ d4 T' ?" {; E4 _7 bacell = mat2cell(a,ones(n,1),ones(n,1));

该用户从未签到

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

本版积分规则

关闭

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

EDA365公众号

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

GMT+8, 2025-6-23 14:01 , Processed in 0.078125 second(s), 23 queries , Gzip On.

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

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

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