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

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

[复制链接]

该用户从未签到

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

EDA365欢迎您登录!

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

x
Matlab里怎么把元胞数组的内容转化为矩阵?(元胞数组的每个元胞都是double型的数)。! [" J/ d& U1 I9 q

该用户从未签到

2#
发表于 2020-5-8 13:25 | 只看该作者
CELL2MAT Convert the contents of a cell array into a single matrix.
$ |+ Q! m9 J" e8 J    M = CELL2MAT(C) converts a multidimensional cell array with contents of  y1 `* [1 f; A# N% w# r6 C" I0 t
    the same data type into a single matrix. The contents of C must be able
1 k. s6 O7 ]/ N9 ?6 R    to concatenate into a hyperrectangle. Moreover, for each pair of
4 d! w: m: W1 x! _, H6 c    neighboring cells, the dimensions of the cell's contents must match,. c0 f# y8 G8 v1 y+ t$ x
    excluding the dimension in which the cells are neighbors. This constraint) d) J: ~  ]4 `  S0 O# K9 ]
    must hold true for neighboring cells along all of the cell array's! a8 d3 S1 k1 g1 A
    dimensions.$ e$ }+ t3 ^8 @/ w

) q( }+ g$ T+ w7 e    The dimensionality of M, i.e. the number of dimensions of M, will match% Y/ K! f0 t  o
    the highest dimensionality contained in the cell array./ o' J8 L2 |  Q' u) d0 {

% W6 A9 u# R8 D2 Q2 _8 l    CELL2MAT is not supported for cell arrays containing cell arrays or
  u" O; X- M3 t) i7 H) s" U' p    objects.
2 Q0 m0 [/ o: F; K4 J  r, e7 j
        Example:
' r* ?8 T( O9 U           C = {[1] [2 3 4]; [5; 9] [6 7 8; 10 11 12]};
) r; G$ X# x- E6 ]) n+ R  u" G, P; u           M = cell2mat(C)
9 Z: y" a0 t# c: O% m0 e; q, p; V4 T: i; x7 z$ r0 n
        See also mat2cell, num2cell
9 R9 {4 b% \1 [7 b$ e' D$ s- l
( t! s! E* ?% x4 ]# U, I    Overloaded methods:" f& c, [$ D3 U
       distributed/cell2mat
9 K$ W/ v- m" c- ]0 ^$ p/ ~3 _8 L9 I9 X& J. Q. Q( l- b
    Reference page in Help browser3 D& S/ T+ t2 Q" @" ~1 l
       doc cell2mat

该用户从未签到

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

" t( Z* e- c$ S( L7 D) r1 j$ Qhelp cell2mat

该用户从未签到

4#
发表于 2020-5-8 14:18 | 只看该作者
仔细看下mat2cell命令,不只能转化成1*1的cell。" ^0 {8 X% l( u4 K
! I1 d9 b- u. b* ]
n = 10;$ _1 ]5 Z5 }, z: i4 R
a = rand(n);
3 u1 Y. B) M9 N7 H9 i" @  ?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-6 03:16 , Processed in 0.125000 second(s), 24 queries , Gzip On.

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

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

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