HRESHAPE

Reshape an HDS object

Description:

Changes the dimensions of the specified object. The number of dimensions may be decreased but the total number of elements must remain the same unless only the length of the last (or only) dimension is changed. If the size is decreased, elements will be discarded; if it is increased, the value of additional elements is not defined. The operation will fail if the object is a structure array and any truncated elements contain components.

Usage:

hreshape inp dims

Parameters:

INP = CHAR (Read)
The name of the object to be re-shaped. <GLOBAL.HDSOBJ >
DIMS() = INTEGER (Read)
New dimensions of object, comma or space separated and enclosed in [ ] if more than one ([ ] optional in response to a prompt).

Examples:

Assuming numarr is a 50x100 array of numbers:
% hreshape numarr 5000
Changes numvarr to a 5000 element vector.
% hreshape numarr [50,50]
Produces a 50x50 array of numbers. Elements [:50-100] are discarded.
% hreshape numarr [50,100]
After the last example this would restore the original shape of numarr but the previously discarded values may be lost.

Method

Uses HDS subroutines DAT_ALTER or DAT_MOULD as appropriate.