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

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

[复制链接]

该用户从未签到

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

EDA365欢迎您登录!

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

x
Matlab里怎么把元胞数组的内容转化为矩阵?(元胞数组的每个元胞都是double型的数)。
, h  C; q1 Y& ~7 }/ t3 i

该用户从未签到

2#
发表于 2020-5-8 13:25 | 只看该作者
CELL2MAT Convert the contents of a cell array into a single matrix.8 N) f, p6 T' F6 j! u+ Q
    M = CELL2MAT(C) converts a multidimensional cell array with contents of
: H7 N3 H/ ~, {2 t3 G( i; A    the same data type into a single matrix. The contents of C must be able
$ l" Q* q+ k: j5 T  o& _    to concatenate into a hyperrectangle. Moreover, for each pair of& {- @( w3 r% u- ?' n& Y
    neighboring cells, the dimensions of the cell's contents must match,9 l" n2 @( B. V: X7 g# u9 N- R  W3 M
    excluding the dimension in which the cells are neighbors. This constraint9 o; n: O, m# F7 [( R# R
    must hold true for neighboring cells along all of the cell array's
8 K2 h7 q, `9 D$ P- k7 I    dimensions.
, k+ ?* Q' p7 N+ ^2 h- j4 g/ W' o! K+ s% z( |0 k
    The dimensionality of M, i.e. the number of dimensions of M, will match' E# T6 d$ N4 R' F$ R' [
    the highest dimensionality contained in the cell array.9 D! {7 N2 W6 r- ~3 k/ S

( w' O2 m5 A# e  l# p0 z    CELL2MAT is not supported for cell arrays containing cell arrays or
# Z9 {; J$ H4 q' C% L% L6 _    objects.
% O; `. ?/ X  |4 L9 C7 j2 A8 Q, T8 \) F) n
        Example:
6 U% z5 Z) n% L& W& o8 H           C = {[1] [2 3 4]; [5; 9] [6 7 8; 10 11 12]};
; G8 {3 r' A# w. [& Q           M = cell2mat(C)
& V0 H1 I6 `$ u) x. k6 i3 V* o
" B/ U9 ]: t+ K        See also mat2cell, num2cell( J! W+ {# W; p& A" E

- {/ w  q6 d+ h3 c    Overloaded methods:3 U, z2 A( k, M5 P! K( Z
       distributed/cell2mat
; M% h4 i/ ?2 i8 ?
& |! b% h. P! O% M2 d) w    Reference page in Help browser
: z2 b+ q/ q$ N( q) d! W       doc cell2mat

该用户从未签到

3#
发表于 2020-5-8 13:25 | 只看该作者
- J6 K) t8 r3 q: k
help cell2mat

该用户从未签到

4#
发表于 2020-5-8 14:18 | 只看该作者
仔细看下mat2cell命令,不只能转化成1*1的cell。
2 G! }, P2 k. ]' X2 V! {+ {1 E4 f  z! H0 a. k
n = 10;  M  [" F0 h1 t  q) W" d. G
a = rand(n);
( L+ [; V: w3 f( C+ u  ^$ x8 u& b  xacell = 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 11:38 , Processed in 0.156250 second(s), 23 queries , Gzip On.

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

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

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