Replicate and tile an array
B = repmat(A, siz) B = repmat(A, m) B = repmat(A, m, n,...)
A must be replicated
along the respective dimensions #1, #2, etc..
siz=[m,n,..].
repmat(A, m) replicates and tiles
m × m copies of A.
repmat(A, m, n) or
repmat(A, [m, n]) replicates and tiles
m × n copies of A.
repmat(A, m, n, p, ..) is a generalization of repmat(A, m, n).
repmat(…) extends ones(m,n,..) .*. A
to non-numerical inputs A.
repmat(…)'s definition can be extended using the overloading mechanism.
repmat([-1 3 7], 2, 4) repmat(int8([1 -2 3; 0 -1 1]), 2, 4, 2) b = cat(3, [%f %t %t], [%t %t %f]) repmat(b, [2 3]) t = "Scilab"; t(ones(2,4)) repmat(["Scilab" "Xcos"], 2, 3) repmat([1/%s ; 2/(%s+1)], 1, 3) | ![]() | ![]() |
--> repmat([-1 3 7], 2, 4)
ans =
-1. 3. 7. -1. 3. 7. -1. 3. 7. -1. 3. 7.
-1. 3. 7. -1. 3. 7. -1. 3. 7. -1. 3. 7.
--> repmat(int8([1 -2 3; 0 -1 1]), 2, 4, 2)
ans =
(:,:,1)
1 -2 3 1 -2 3 1 -2 3 1 -2 3
0 -1 1 0 -1 1 0 -1 1 0 -1 1
1 -2 3 1 -2 3 1 -2 3 1 -2 3
0 -1 1 0 -1 1 0 -1 1 0 -1 1
(:,:,2)
1 -2 3 1 -2 3 1 -2 3 1 -2 3
0 -1 1 0 -1 1 0 -1 1 0 -1 1
1 -2 3 1 -2 3 1 -2 3 1 -2 3
0 -1 1 0 -1 1 0 -1 1 0 -1 1
--> b = cat(3, [%f %t %t], [%t %t %f])
b =
(:,:,1)
F T T
(:,:,2)
T T F
--> repmat(b, [2 3])
ans =
(:,:,1)
F T T F T T F T T
F T T F T T F T T
(:,:,2)
T T F T T F T T F
T T F T T F T T F
--> t = "Scilab"; t(ones(2,4))
ans =
"Scilab" "Scilab" "Scilab" "Scilab"
"Scilab" "Scilab" "Scilab" "Scilab"
--> repmat(["Scilab" "Xcos"], 2, 3)
ans =
"Scilab" "Xcos" "Scilab" "Xcos" "Scilab" "Xcos"
"Scilab" "Xcos" "Scilab" "Xcos" "Scilab" "Xcos"
--> repmat([1/%s ; 2/(%s+1)], 1, 3)
ans =
1 1 1
- - -
s s s
2 2 2
---- ---- ----
1 +s 1 +s 1 +s
| Version | Description |
| 5.3.1 | Function repmat introduced. |