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

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

[复制链接]

该用户从未签到

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

EDA365欢迎您登录!

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

x
Matlab里怎么把元胞数组的内容转化为矩阵?(元胞数组的每个元胞都是double型的数)。3 D/ B, Q0 Y: F2 B% c: }& ^$ t+ N( z

该用户从未签到

2#
发表于 2020-5-8 13:25 | 只看该作者
CELL2MAT Convert the contents of a cell array into a single matrix.1 K; R# S; v& \8 ]! t- |8 T
    M = CELL2MAT(C) converts a multidimensional cell array with contents of3 k# @" q- Q  i) u0 E( s
    the same data type into a single matrix. The contents of C must be able
: }& k6 U$ q+ w    to concatenate into a hyperrectangle. Moreover, for each pair of) X2 z% J2 |. F+ d- r8 _
    neighboring cells, the dimensions of the cell's contents must match,
) A9 Q4 G, W7 J% N    excluding the dimension in which the cells are neighbors. This constraint
' i% P  B; C+ M8 b    must hold true for neighboring cells along all of the cell array's
% M' n5 o& i7 q) A; j( T2 |9 n    dimensions.
# [5 w  e5 q$ X+ T8 A( i, S) U2 v( y+ A! ~3 U2 w* X* g
    The dimensionality of M, i.e. the number of dimensions of M, will match% t$ T7 \* `; p6 W  t
    the highest dimensionality contained in the cell array.
' t  @3 \4 [' Q+ R( `3 O8 u: M% b" I* N- @  [
    CELL2MAT is not supported for cell arrays containing cell arrays or
$ U2 }4 t2 L' h5 J3 j    objects.
3 u: l- j1 m( q2 ^$ \3 O: c9 z; G" J% @
        Example:5 I4 {6 Z2 q% c: U5 `+ x
           C = {[1] [2 3 4]; [5; 9] [6 7 8; 10 11 12]};
4 e4 a$ X  `  |0 u* u1 B  q9 B1 a) M           M = cell2mat(C)6 _* D+ z) n: z/ j/ N( N& p

4 Y( O5 ]% O" R; p1 e* _6 g        See also mat2cell, num2cell% L6 r6 v. U" D

7 o5 K' y$ {3 P/ T$ C, v! l    Overloaded methods:
$ g1 Y' r3 B9 q2 V% _( D2 A       distributed/cell2mat
" g; F5 e0 v' i& ]+ x% e* e6 z& a+ L3 \! m
    Reference page in Help browser
9 R" {5 u$ K/ [- J6 Q       doc cell2mat

该用户从未签到

3#
发表于 2020-5-8 13:25 | 只看该作者
( ?0 W& a6 t, u; _% E5 f+ S
help cell2mat

该用户从未签到

4#
发表于 2020-5-8 14:18 | 只看该作者
仔细看下mat2cell命令,不只能转化成1*1的cell。9 ?: b% g' ^& E- s7 z
2 e3 P- F) E1 u1 d
n = 10;
, a9 u* X7 M' oa = rand(n);
0 @" l% ~0 t9 g+ U/ P# Sacell = 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-4 16:45 , Processed in 0.187500 second(s), 23 queries , Gzip On.

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

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

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