DADiSP Worksheet Functions > Function Categories > Data Manipulation and Editing > CIRCSHIFT

 

CIRCSHIFT

Purpose:

Performs a circular shift of a series.

Syntax:

CIRCSHIFT(series, n, m)

series

-

A series, the input series.

n

-

An integer, the positive or negative shift size.

m

-

Optional. An integer, the column shift value if the input is an array.

Returns:

A series, the shifted result.

Example:

W1: 1..5

W2: circshift(w1, 2)

W3: circshift(w1, -2)

 

W1 == {1, 2, 3, 4, 5}

W2 == {4, 5, 1, 2, 3}

W3 == {3, 4, 5, 1, 2}

Example:

W1: {{1, 2, 3}, {4, 5, 6}, {7, 8, 9}}

W2: circshift(w1, 2)

W3: circshift(w1, -2)

W4: circshift(w1, 2, -1)

 

W1 == {{1, 2, 3},

       {4, 5, 6},

       {7, 8, 9}}

 

W2 == {{4, 5, 6},

       {7, 8, 9},

       {1, 2, 3}}

 

W3 == {{7, 8, 9},

       {1, 2, 3},

       {4, 5, 6}}

 

W4 == {{5, 6, 4},

       {8, 9, 7},

       {2, 3, 1}}

Remarks:

For a series, a positive shift size shifts the series right and a negative shift size shifts left.

 

For an array, a positive shift size shifts the array down and a negative shift size shifts the array up. If the column shift is specified, a positive values shifts the columns right and a negative value shifts the columns left.

See Also:

DELAY

EXTRACT

FFTSHIFT

IFFTSHIFT