matlab中repmat函数的用法
2015-10-15 16:46
393 查看
转自:http://blog.csdn.net/anqier1009/article/details/5214978
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
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
相关文章推荐
- EKF-SLAM matlab仿真(1)
- 线性规划问题的matlab求解
- matlab 如何读取二进制、十六进制txt文档
- Matlab中各类函数用法
- MATLAB对于文本文件(txt)数据读取的技巧总结(经典中的经典)
- Matlab 字符串处理函数
- 解决办法:matlab Exception in thread "AWT-EventQueue-0" java.lang.OutOfMemoryError: Java heap
- Caffe matlab之基于Alex network的特征提取
- matlab unique找出矩阵中不同元素
- 使用matlab进行多项式的拟合
- matlab中size()函数的用法
- matlab中find函数的使用说明
- MATLAB数字图像处理(二)直方图
- matlab将多条曲线绘制在一起
- matlab链接摄像头
- matlab下文件夹下所有文件改名
- matlab函数(连通区域)
- Matlab生成exe可执行文件
- Matlab矩阵转置注意事项
- matlab入门 蜂窝阵列