circshift - Shift array circularly
Syntax
B = circshift(A,shiftsize)
Description
B = circshift(A,shiftsize) circularly
shifts the values in the array, A, by shiftsize elements. shiftsize is
a vector of integer scalars where the n-th element
specifies the shift amount for the n-th dimension
of array A. If an element in shiftsize is
positive, the values of A are shifted down (or
to the right). If it is negative, the values of A are
shifted up (or to the left). If it is 0, the values
in that dimension are not shifted.
Example
Circularly shift first dimension values down by 1.
A = [ 1 2 3;4 5 6; 7 8 9]
A =
1 2 3
4 5 6
7 8 9
B = circshift(A,1)
B =
7 8 9
1 2 3
4 5 6Circularly shift first dimension values down by 1 and second
dimension values to the left by 1.
B = circshift(A,[1 -1]);
B =
8 9 7
2 3 1
5 6 4See Also
fftshift, shiftdim, permute, reshape
 | cholupdate | | circumcenters (TriRep) |  |
Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.
Get the Interactive Kit