• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

【转】matlab reshape使用

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

转自:http://hi.baidu.com/lingyin55/blog/item/252144f27e6bfe16b07ec587.html/cmtid/e68dc9c6085e7c159c163d47

 

reshape把指定的矩阵改变形状,但是元素个数不变, 

例如,行向量: 
a = [1 2 3 4 5 6] 

执行下面语句把它变成3行2列: 
b = reshape(a,3,2) 

执行结果: 
b = 
1 4 
2 5 
3 6

若a=[1 2 3 
4 5 6 
7 8 9]

使用reshpe后想得到b=[1 2 3 4 5 6 7 8 9]

只需要将a转置一下就可以了: 
b=reshape(a\',1,9)

----------------------------------------------

matlab中的解释如下:

RESHAPE Change size.
    RESHAPE(X,M,N) returns the M-by-N matrix whose elements
    are taken columnwise from X. An error results if X does
    not have M*N elements.

    RESHAPE(X,M,N,P,...) returns an N-D array with the same
    elements as X but reshaped to have the size M-by-N-by-P-by-...
    M*N*P*... must be the same as PROD(SIZE(X)).

    RESHAPE(X,[M N P ...]) is the same thing.

    RESHAPE(X,...,[],...) calculates the length of the dimension
    represented by [], such that the product of the dimensions 
    equals PROD(SIZE(X)). PROD(SIZE(X)) must be evenly divisible 
    by the product of the known dimensions. You can use only one 
    occurrence of [].

    In general, RESHAPE(X,SIZ) returns an N-D array with the same
    elements as X but reshaped to the size SIZ. PROD(SIZ) must be

    the same as PROD(SIZE(X)). 


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
matlab reshape()、full() - 一动不动的葱头发布时间:2022-07-18
下一篇:
Matlab中reshape 模块的使用发布时间:2022-07-18
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap