REVERSE
The REVERSE function reverses the order of one dimension of an array.
Tip: To reverse a string use the IDL_String.Reverse method.
This routine is written in the IDL language. Its source code can be found in the file reverse.pro in the lib subdirectory of the IDL distribution.
Examples
Reverse the order of an array where each element is set to the value of its subscript:
A = [[0,1,2],[3,4,5],[6,7,8]]
PRINT, 'Original Array:'
PRINT, A
PRINT, 'Reversed Columns:'
PRINT, REVERSE(A)
PRINT, 'Reversed Rows:'
PRINT, REVERSE(A, 2)
IDL prints:
Original Array:
0 1 2
3 4 5
6 7 8
Reversed Columns:
2 1 0
5 4 3
8 7 6
Reversed Rows:
6 7 8
3 4 5
0 1 2
Syntax
Result = REVERSE( Array [, Subscript_Index] [, /OVERWRITE] )
Return Value
Returns the reversed dimension of the array.
Arguments
Array
The array containing the original data.
Subscript_Index
An integer specifying the dimension index (1, 2, 3, etc.) that will be reversed. This argument must be less than or equal to the number of dimensions of Array. If this argument is omitted, the first subscript is reversed.
Keywords
OVERWRITE
Set this keyword to conserve memory by doing the transformation “in-place.” The result overwrites the previous contents of the array. This keyword is ignored for one- or two-dimensional arrays.
Version History
See Also
INVERT, REFORM, ROT, ROTATE, SHIFT, TRANSPOSE