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.

Shift array circularly

`Y = circshift(A,K)`

`Y = circshift(A,K,dim)`

`Y = circshift(`

circularly
shifts the elements in array `A`

,`K`

)`A`

by `K`

positions.
If `K`

is an integer, then `circshift`

shifts
along the first dimension of `A`

whose size does
not equal 1. If `K`

is a vector of integers, then
each element of `K`

indicates the shift amount in
the corresponding dimension of `A`

.

The default behavior of `circshift(A,K)`

where `K`

is
a scalar changed in R2016b. To preserve the behavior of R2016a and
previous releases, use `circshift(A,K,1)`

. This syntax
specifies 1 as the dimension to operate along.

Was this topic helpful?