Note: This page has been translated by MathWorks. Click here to see

To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

Repeat copies of array elements

`u = repelem(v,n)`

`B = repelem(A,r1,...,rN)`

,
where `u`

= repelem(`v`

,`n`

)`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`

.

This syntax is not supported for `table`

input.

returns
an array with each element of `B`

= repelem(`A`

,`r1,...,rN`

)`A`

repeated according
to `r1,...,rN`

. Each `r1,...,rN`

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`

.