| MATLAB Function Reference | ![]() |
Syntax
Description
creates a large matrix B = repmat(A,m,n)
B consisting of an m-by-n tiling of copies of A. The statement repmat(A,n) creates an n-by-n tiling.
B = repmat(A,[m n])
accomplishes the same result as repmat(A,m,n).
B = repmat(A,[m n p...])
produces a multidimensional (m-by-n-by-p-by-...) array composed of copies of A. A may be multidimensional.
repmat(A,m,n)
when A is a scalar, produces an m-by-n matrix filled with A's value. This can be much faster than a*ones(m,n) when m or n is large.
Examples
In this example, repmat replicates 12 copies of the second-order identity matrix, resulting in a "checkerboard" pattern.
B = repmat(eye(2),3,4) B = 1 0 1 0 1 0 1 0 0 1 0 1 0 1 0 1 1 0 1 0 1 0 1 0 0 1 0 1 0 1 0 1 1 0 1 0 1 0 1 0 0 1 0 1 0 1 0 1
The statement N = repmat(NaN,[2 3]) creates a 2-by-3 matrix of NaNs.
| rem | reset | ![]() |