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

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

[复制链接]

该用户从未签到

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

EDA365欢迎您登录!

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

x
Matlab里怎么把元胞数组的内容转化为矩阵?(元胞数组的每个元胞都是double型的数)。
9 m% Z0 x& N) C7 S7 P

该用户从未签到

2#
发表于 2020-5-8 13:25 | 只看该作者
CELL2MAT Convert the contents of a cell array into a single matrix." A% B- D1 P5 H
    M = CELL2MAT(C) converts a multidimensional cell array with contents of
8 r, L+ W" E$ f. P/ h& a/ Y1 M; O    the same data type into a single matrix. The contents of C must be able# y1 M! h: X3 J& k4 Z0 t0 I
    to concatenate into a hyperrectangle. Moreover, for each pair of
2 W8 y9 s" j2 k; s' H) M    neighboring cells, the dimensions of the cell's contents must match,
$ ^) ~: O0 a1 x5 f6 X# {    excluding the dimension in which the cells are neighbors. This constraint
6 @0 W8 |& R  O: w2 j9 b4 }    must hold true for neighboring cells along all of the cell array's: Q) [; Z7 V( [- ~7 [0 v/ Z  T$ }
    dimensions.
# i- b: W* U, t4 W7 [
2 U" J0 ]0 o$ Y+ a. i$ E3 n    The dimensionality of M, i.e. the number of dimensions of M, will match; R( M( T$ X& n$ G& j
    the highest dimensionality contained in the cell array.
6 ?- o. M7 Y' L5 \" Q5 m
) N" B% Q. g" T+ p) R# Y    CELL2MAT is not supported for cell arrays containing cell arrays or- w" F* P& k0 v" q
    objects.
% A  X) K7 ]0 J5 h9 W
, E9 \& v2 O  s- _# M        Example:& e4 X: p  }  [( q7 p
           C = {[1] [2 3 4]; [5; 9] [6 7 8; 10 11 12]};
% ]- c7 o. o" L7 S4 Q  ~* w& b           M = cell2mat(C)+ t' q8 T) A: t8 ]3 f

: T9 Y, m( w1 g2 c- S6 G% g0 {        See also mat2cell, num2cell
6 e4 `2 [8 o  x; y0 \- ?4 x' S- \( [  t! n2 [/ a4 A
    Overloaded methods:8 z6 K/ W5 X% a! r
       distributed/cell2mat
8 E& `& i! ^( A4 \+ N* d
# K1 q3 l7 W! I. [5 P, R% K) B    Reference page in Help browser- K: y& q* c- K$ P8 Y) p6 V; a& f
       doc cell2mat

该用户从未签到

3#
发表于 2020-5-8 13:25 | 只看该作者
  B+ K9 h! ~- t# R4 K
help cell2mat

该用户从未签到

4#
发表于 2020-5-8 14:18 | 只看该作者
仔细看下mat2cell命令,不只能转化成1*1的cell。
; ?. n. y0 g/ E1 `
/ H, `( N) ?; q/ }1 En = 10;
8 J( Z$ ?" q6 g! N  d, Ua = rand(n);' P4 ^+ s7 ?5 d+ v+ k
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-7-23 01:51 , Processed in 0.125000 second(s), 24 queries , Gzip On.

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

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

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