Circularly shift the values of the array x.
n must be a vector of integers no longer than the number of dimensions in x. The values of n can be either positive or negative, which determines the direction in which the values of x are shifted. If an element of n is zero, then the corresponding dimension of x will not be shifted.
If a scalar dim is given then operate along the specified dimension. In this case n must be a scalar as well.
Examples:
x = [1, 2, 3; 4, 5, 6; 7, 8, 9];
circshift (x, 1)
⇒ 7, 8, 9
1, 2, 3
4, 5, 6
circshift (x, -2)
⇒ 7, 8, 9
1, 2, 3
4, 5, 6
circshift (x, [0,1])
⇒ 3, 1, 2
6, 4, 5
9, 7, 8
See also: permute, ipermute, shiftdim.
Package: octave