About Chandra Archive Proposer Instruments & Calibration Newsletters Data Analysis HelpDesk Calibration Database NASA Archives & Centers Chandra Science Links

Skip the navigation links
Last modified: December 2006

URL: http://cxc.harvard.edu/ciao3.4/shift.tm.html
Hardcopy (PDF): A4 | Letter
AHELP for CIAO 3.4 shift Context: slangrtl

Synopsis

Shift the elements of a 1-d array

Syntax

Array_Type shift (Array_Type A, Int_Type n)

Description

The shift function shifts the elements of an array by a specified amount and returns the result. If n is positive, the ith element of the array will be shifted to the position i-n of the array. Elements for which i-n is less than 0 will be moved to the end of the array.

Example

A = [1,2,3,4,5,6,7,8,9];
B = shift (A, 3);          % ==> B = [4,5,6,7,8,9,1,2,3];
C = shift (A, -1);         % ==> C = [9,1,2,3,4,5,6,7,8];

NOTES

In many ways rotate would be a better name for this function.

See Also

slangrtl
sum, transpose
Hardcopy (PDF): A4 | Letter
Last modified: December 2006



The Chandra X-Ray Center (CXC) is operated for NASA by the Smithsonian Astrophysical Observatory.
60 Garden Street, Cambridge, MA 02138 USA.    Email: cxcweb@head.cfa.harvard.edu
Smithsonian Institution, Copyright © 1998-2004. All rights reserved.