repmat
Tile an array by replicating its contents.
Syntax
Section titled “Syntax”B = repmat(A, n)B = repmat(A, m, n)B = repmat(A, m, n, p, ...)B = repmat(A, [m n ...])Description
Section titled “Description”Builds a tiled array by replicating A. repmat(A, m, n) produces an m × n block grid of copies of A; the result has size [size(A,1)*m, size(A,2)*n]. The single-integer form repmat(A, n) is equivalent to repmat(A, n, n). The vector form takes the tile counts per dimension.
Examples
Section titled “Examples”repmat([1 2; 3 4], 2) % 4×4: [1 2 1 2; 3 4 3 4; 1 2 1 2; 3 4 3 4]repmat([1 2 3], 4, 1) % 4×3 of identical rowsrepmat(eye(2), [2 2 3]) % 4×4×3 stack