The REFORM function changes the dimensions of an array without changing the total number of elements.
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 = INTARR(10,10,10)
b = a[5,*,*]
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])
Result = REFORM( Array, D1[, ..., D8] [, /OVERWRITE] )
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.
The array to have its dimensions modified.
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.
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)
REVERSE, ROT, ROTATE, TRANSPOSE