Constructs an array of a specified shape from the elements of a given array.
Class
Transformational function
Result Value
The result is an array with shape SHAPE. It has the same data type as SOURCE.
The array elements of SOURCE are placed into the result in the order of dimensions as specified by ORDER, or in the usual order for array elements if ORDER is not specified.
The array elements of SOURCE are followed by the array elements of PAD in array element order, and followed by additional copies of PAD until all of the elements of the result are set.
Examples
! Turn a rank-1 array into a 3x4 array of the
! same size.
RES= RESHAPE( (/A,B,C,D,E,F,G,H,I,J,K,L/), (/3,4/)
! The result is | A D G J |
! | B E H K |
! | C F I L |
! Turn a rank-1 array into a larger 3x5 array.
! Keep repeating -1 and -2 values for any
! elements not filled by the source array.
! Fill the rows first, then the columns.
RES= RESHAPE( (/1,2,3,4,5,6/), (/3,5/), &
(/-1,-2/), (/2,1/) )
! The result is | 1 2 3 4 5 |
! | 6 -1 -2 -1 -2 |
! | -1 -2 -1 -2 -1 |
Related Information