B = repmat(A,M,N) or B = repmat(A,[M,N]) creates a large matrix B consisting of an M-by-N tiling of copies of A. If A is a matrix, the size of B is [size(A,1)*M, size(A,2)*N]. B = repmat(A,N) creates an N-by-N tiling.
A = [1 2;3 4] or A也可以为字符串
X1 = repmat(A , 2, 3)
>> A = [1 2;3 4]
X1 = repmat(A , 2, 3)
输出结果为
A =
1 2
3 4
X1 =
1 2 1 2 1 2
3 4 3 4 3 4
1 2 1 2 1 2
3 4 3 4 3 4
得到矩阵:将A矩阵复制2行3列的。与 “X1 = repmat(A , [2 3]) ”结果相同
X2 = repmat(A , 2)
>> A = [1 2;3 4]
X2 = repmat(A , 2)
输出结果为
A =
1 2