Repeat copies of array elements

Syntax and Description

repelem(v,n) where v is a scalar or vector, returns a vector of repeated elements of v.
  • If n is a scalar, then each element of v is repeated n times. The length of u is length(v)*n.
  • If n is a vector, then it must be the same length as v. Each element of n specifies the number of times to repeat the corresponding element of v.
repelem(A,r1,r2) returns an array with each element of A repeated according to r1 and r2. Each r1 and r2 must either be a scalar or a vector with the same length as A in the corresponding dimension. For example, if A is a matrix, repelem(A,2,3) returns a matrix containing a 2-by-3 block of each element of A.

Back to functions