IDL

REFORM

REFORM

The REFORM function changes the dimensions of an array without changing the total number of elements.

Examples


REFORM can be used to remove “degenerate” leading dimensions of size one. Such dimensions can appear when a subarray is extracted from an array with more dimensions. For example

; a is a 3-dimensional array:
a = INTARR(10,10,10)
; Extract a "slice" from a:
b = a[5,*,*]
; Use HELP to show what REFORM does:
HELP, b, REFORM(b)

Executing the above statements produces the output:

B            INT = Array[1, 10, 10]
<Expression> INT = Array[10, 10]

The statements have the identical effect. They create a new array, b, with dimensions of (200, 5), from a.:

b = REFORM(a,200,5)
b = REFORM(a,[200,5])

Syntax


Result = REFORM( Array, D1[, ..., D8] [, /OVERWRITE] )

Return Value


If no dimensions are specified, REFORM returns a copy of Array with all dimensions of size 1 removed. If dimensions are specified, the result is given those dimensions. Only the dimensions of Array are changed--the actual data remains unmodified.

Arguments


Array

The array to have its dimensions modified.

Di

Either an array or a series of scalar expressions specifying the dimensions of the result. If a single argument is specified, it can be either a scalar expression or an array of up to eight elements. If multiple arguments are specified, they must all be scalar expressions. Array must have the same number of elements as specified by the product of the new dimensions.

Keywords


OVERWRITE

Set this keyword to cause the specified dimensions to overwrite the present dimensions of the Array parameter. No data are copied, only the internal array descriptor is changed. The result of the function, in this case, is the Array parameter with its newly-modified dimensions. For example, to change the dimensions of the variable a, without moving data, enter:

a = REFORM(a, n1, n2, /OVERWRITE)
 

Version History


Original

Introduced

See Also


REVERSE, ROT, ROTATE, TRANSPOSE



Notes


This page has no user notes yet. Be the first one!


This information is not subject to the controls of the International Traffic in Arms Regulations (ITAR) or the Export Administration Regulations (EAR). However, it may be restricted from transfer to various embargoed countries under U.S. laws and regulations.
© 2014 Exelis Visual Information Solutions