Repmat:replicate and tile an array
Syntax
B = Repmat (a,m,n)
B = Repmat (a,[m n])
B = Repmat (a,[m n p ...])
Description
b = Repmat (a,m,n) creates a large matrix B consisting of an m-by-n tiling of copies of a. The size of B is [size (a,1) *m, (Size (a,2) *n]. 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 array b composed of copies of a . the size of b is [size (a,1) *m, size (a,2) *n, size (A,3) *p, ...].
Repmat (A,m,n) when a was a scalar, produces an m-by-n matrix filled with a ' s value and have A's class. For certain values, you can achieve the same results using other functions, as shown by the following Examples:repmat (NaN , m,n) returns the same result as NaN (M,n). Repmat (single (INF), m,n) are the same as INF (M,n, ' single '). Repmat (int8 (0), m,n) is the same as zeros (M,n, ' int8 '). Repmat (UInt32 (1), m,n) is the same as ones (M,n, ' UInt32 '). Repmat (Eps,m,n) is the same as EPS (Ones (M,n)).
Examples
In this example, Repmat replicates copies of the Second-order identity matrix, resulting in a "checkerboard" pattern.
B = Repmat (eye (2), 3,4)%size (eye (2), 1) = 2; Size (eye (2), 2) = 2;
B =% (3*2;4*2;) eye (2) whole to right becomes 8; down to 6
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.
Repmat:replicate and tile an array