MATLAB中repmat的运用
2015-06-13 17:41
399 查看
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 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中permute的运用
- Matlab的Profile功能
- 用MATLAB發EMAIL以及給全北大同學群發EMAIL呵呵呵
- 远程计算_使用Matlab计算引擎
- 用OxyPlot在WPF中演示正演磁异常的变化规律
- 在64位系统上不能安装Matlab notebook的解决方案
- MATLAB中统计程序执行时间
- Matlab变量名的神奇问题
- 关于matlab SVM工具箱的问题
- matlab 学习资料收集
- Matlab拟合曲线之幂律分布
- Matlab与VC6联合编程备忘录
- MATLAB——scatter的简单应用
- matlab中“执行字符串”函数eval在不同情况下的用法(二)
- MATLAB中feval、class、'function_handle'、isa、strcmp的用法
- 分享快速双边滤波matlab程序
- MATLAB——axis
- MATLAB——PLOT绘图
- 统计相关系数(3)——Kendall Rank(肯德尔等级)相关系数及MATLAB实现
- matlab的inpolygon用法简单介绍