Cicode Programming Reference > Cicode Function Categories > Table (Array) Functions Introduction > TableShift

TableShift

Shifts table items in a table by a number of positions. You can shift the table left or right. Items shifted off the end of the table are lost. Items within a table that are not replaced by other items (that have moved) are set to 0.

Note: This function only supports arrays declared in Cicode and not variable tag arrays.

Syntax

TableShift(Table, Size, Count)

Table:

The table to shift, an array of real numbers.

Size:

The maximum number of items in the table.

Count:

The number of positions to shift the table items. A negative Count moves items to the right and a positive Count moves items to the left.

Return Value

0 (zero) if successful, otherwise an error is returned.

Related Functions

TableMath, TableLookup

Example

REAL Levels[5]=10,15,50,100,200;
TableShift(Levels,5,2);
/* Shifts the table items by 2 positions to the left, that is
Levels[0]=50
Levels[1]=100
Levels[2]=200
Levels[3]=0
Levels[4]=0 */

See Also

Table (Array) Functions