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

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

[复制链接]

该用户从未签到

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

EDA365欢迎您登录!

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

x
Matlab里怎么把元胞数组的内容转化为矩阵?(元胞数组的每个元胞都是double型的数)。* J1 f% n+ ?3 S1 V1 G) P. b: P

该用户从未签到

5#
发表于 2020-5-8 17:20 | 只看该作者
有问题就找help

该用户从未签到

4#
发表于 2020-5-8 14:18 | 只看该作者
仔细看下mat2cell命令,不只能转化成1*1的cell。0 s& T- `2 f5 A; I

9 X' }9 J( p+ j# _' f8 an = 10;
1 ~* Z# b6 [" J! \* M5 Q/ Y; L* Ua = rand(n);
) Y- p6 L3 W5 q1 K; L$ eacell = mat2cell(a,ones(n,1),ones(n,1));

该用户从未签到

3#
发表于 2020-5-8 13:25 | 只看该作者
0 R1 w! A0 n# f, _' |/ K- i( w
help cell2mat

该用户从未签到

2#
发表于 2020-5-8 13:25 | 只看该作者
CELL2MAT Convert the contents of a cell array into a single matrix.
8 b) c, `/ Y) g6 ?    M = CELL2MAT(C) converts a multidimensional cell array with contents of; P% X  S. `  `7 h$ E8 q& G
    the same data type into a single matrix. The contents of C must be able4 R5 n: |  u' K. w2 f. t
    to concatenate into a hyperrectangle. Moreover, for each pair of! O! I- I' V1 q. U; H
    neighboring cells, the dimensions of the cell's contents must match,! s0 [8 I9 n' W! i
    excluding the dimension in which the cells are neighbors. This constraint! J4 b! b9 E9 d7 F# E) N
    must hold true for neighboring cells along all of the cell array's
* j7 C* g1 e( O7 F* D    dimensions.  S/ F- @. t  K+ X) c
  d" q3 u; M. e# y; m: U
    The dimensionality of M, i.e. the number of dimensions of M, will match9 T! i+ y, [: P
    the highest dimensionality contained in the cell array.
% K+ H8 G" F. _2 f  V6 ~$ D& s
! B6 x# ?+ }. V% ~    CELL2MAT is not supported for cell arrays containing cell arrays or
; U2 ?5 s. q9 Q/ \5 R! o4 m    objects.
  J, l0 G0 F, n% T9 x1 M* N) n
8 c! H; _9 L7 ]$ l* w        Example:: B: k* t; w4 T; ]1 h  ~2 \* B
           C = {[1] [2 3 4]; [5; 9] [6 7 8; 10 11 12]};8 E$ w' P9 q! |! ?% D
           M = cell2mat(C)4 t! [" @7 O7 Y- d7 m" d
! O( q% l1 m% J. r5 T0 _
        See also mat2cell, num2cell
5 F  s3 D3 r% E7 }! w
( B/ z4 s, s" [* g    Overloaded methods:
( [0 X) C, ~4 s  o       distributed/cell2mat
- L4 t1 E6 ^: I% B* d: I+ V$ w* ?: k. G0 m, b' l& S( D
    Reference page in Help browser
' k8 m1 b9 w4 o. D1 \       doc cell2mat
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关闭

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

EDA365公众号

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

GMT+8, 2025-11-24 11:03 , Processed in 0.156250 second(s), 24 queries , Gzip On.

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

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

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