The REFORM function changes the dimensions of an array without changing the total number of elements. If no dimensions are specified, REFORM returns a copy of Array with all leading 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.
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:
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) ; a is a 3-dimensional array.
b = a[5,*,*] ; Extract a "slice" from a.
HELP, b, REFORM(b) ; Use HELP to show what REFORM does.
Executing the above statements produces the output:
<Expression> INT = Array[10, 10]
have identical effect. They create a new array, b, with dimensions of (200, 5), from a.