repmat
Replicates an input to create a block matrix with the number of specified replications in each dimension.
Syntax
repmat (A, m)
repmat (A, m, n, ...)
repmat (A, [m, n, ...])
Inputs
- A
- Value to copy.
- n,m
- Dimensions of the desired matrix.
Outputs
- R
- The block matrix.
Examples
R = repmat([1,2;3,4],3)
R = [Matrix] 6 x 6
1 2 1 2 1 2
3 4 3 4 3 4
1 2 1 2 1 2
3 4 3 4 3 4
1 2 1 2 1 2
3 4 3 4 3 4
R = repmat([1,2,3;4,5,6],4,2)
R = [Matrix] 8 x 6
1 2 3 1 2 3
4 5 6 4 5 6
1 2 3 1 2 3
4 5 6 4 5 6
1 2 3 1 2 3
4 5 6 4 5 6
1 2 3 1 2 3
4 5 6 4 5 6
Comments
When only one replication dimension is specified, it is applied in the first two dimensions to form a square pattern of blocks, similar to ones(n).