FUNCTION REFERENCE

circshift

Shift array elements with wraparound.

Shift array elements with wraparound.

Syntax

circshift(A, K)

Syntax

circshift(A, shifts)

Syntax

circshift(A, K, dim)

Positive shifts move elements toward larger indices. A scalar K shifts along the first non-singleton dimension by default, so it shifts a row vector along its columns. A vector gives one shift per dimension in order. Shifts must be finite integers. The result keeps the input class.

Example

circshift([1 2 3],1)   % [3 1 2]

Example

circshift([1 2;3 4],[1 1])   % [4 3;2 1]

Differences from MATLAB: N-D shifts support numeric, logical and character arrays. Cell and struct arrays support 2-D shifts.

These are the engine’s help pages. Each page keeps its compatibility notes. File operations are unavailable in the browser.