The SIZE function returns a vector that contains size and type information for its argument if no keywords are set. If a keyword is set, SIZE returns the specified quantity.
The returned vector is always of longword type. The first element is equal to the number of dimensions of Expression . This value is zero if Expression is scalar or undefined. The next elements contain the size of each dimension, one element per dimension (none if Expression is scalar or undefined). After the dimension sizes, the last two elements contain the type code (zero if undefined) and the number of elements in Expression , respectively. The type code is described in the table below.
The following keywords determine the return value of the SIZE function. The keywords are mutually exclusive -- specify at most one of the following.
Set this keyword to return the dimensions of Expression . If Expression is scalar, the result is a longword scalar containing a 1. For arrays, the result is a longword array containing the array dimensions.
Set this keyword to return the file unit to which Expression is associated, if it is an IDL file variable, as created with the ASSOC function. If Expression is not a file variable, 0 is returned (0 is not a valid file unit for ASSOC).
Set this keyword to return the number of dimension in Expression , if it is an array. If Expression is scalar, 0 is returned.
Set this keyword to returns the number of data elements in Expression . Setting this keyword is equivalent to using the N_ELEMENTS function.
Set this keyword to return all available information about Expression as an IDL_SIZE structure. Note that since the structure is a named structure, the size of its fields is fixed. The following are descriptions of the fields in the returned structure:
Set this keyword to returns the IDL type code for Expression . See IDL Type Codes for details.
Print the size information for a 10 by 20 floating-point array by entering:
IDL shows that the array has 2 dimensions, equal to 10 and 20, a type code of 4, and 200 elements total.
Similarly, to print only the number of dimensions of the same array: