首页 > 其他 > 详细

matlab 使用札记

时间:2015-07-16 18:14:57      阅读:207      评论:0      收藏:0      [点我收藏+]

1.inline

命令行内置函数,作用同Function一致

2.repmat

B = repmat(A,m,n)
B = repmat(A,[m n])
B = repmat(A,[m n p...])

这是一个处理大矩阵且内容有重复时使用,其功能是以A的内容堆叠在(MxN)的矩阵B中,B矩阵的大小由MxN及A矩阵的内容决定,如果A是一个3x4x5的矩阵,有B = repmat(A,2,3)则最后的矩阵是6x12x5

例如:
>>B=repmat( [1 2;3 4],2,3)
B = 

1      2      1     2    1    2

3      4      3     4    3    4

1     2     1     2     1     2

3     4     3     4     3     4


其结果变为4X6。A也可以置放文字串,如:


>>C=repmat(‘ Long live the king!‘, 2,2)
C =
Long live the king! Long live the king!
Long live the king! Long live the king!

也可置放其他的:


>> D=repmat(NaN,2,5)

D =
NaN   NaN   NaN   NaN   NaN
NaN   NaN   NaN   NaN   NaN

matlab 使用札记

原文:http://www.cnblogs.com/shuren/p/4651532.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!