REFORM Function
Reformats an array without changing its values numerically.
enabled.
Usage
result = REFORM(array, dim1, ... , dimn)
Input Parameters
array—The array that is to have its dimensions modified. Must have the same total number of elements as specified by the new dimensions.
dimi—The dimensions of the result. Alternatively, you can specify the dimensions in a vector. See the Example section for more information.
Returned Value
result—The reformated array.
Keywords
None.
Discussion
REFORM returns a copy of array with the dimensions specified. If no dimensions are specified, then REFORM returns a copy of array with all dimensions of size 1 removed. Only the dimensions of array are changed; the actual data remains unaltered.
 
note
REFORM is useful for removing degenerate leading dimensions of size one. These leading dimensions can be created when you extract a subarray from an array with more dimensions.
Example
To use REFORM to remove degenerate leading dimensions:
; The variable a is a 3-dimensional array.
a = INTARR(10, 10, 10)
; Extract a "slice" from a.
b = a(5, *, *)
; Use INFO to show what REFORM did.
INFO, b, REFORM(b)
; PV-WAVE prints:
; B            INT =   Array(1, 10, 10) 
; <Expression> INT =   Array(10, 10)
Note that the two statements:
b = REFORM(a,200,5)
b = REFORM(a,[200,5])
have identical effect. They create a new array b, with dimensions of (200, 5), from a.
See Also