IDL

TEMPORARY

TEMPORARY

The TEMPORARY function returns a temporary copy of a variable, and sets the original variable to “undefined”. This function can be used to conserve memory when performing operations on large arrays, as it avoids making a new copy of results that are only temporary. In general, the TEMPORARY routine can be used to advantage whenever a variable containing an array on the left hand side of an assignment statement is also referenced on the right hand side.

Examples


Assume the variable A is a large array of integers. The statement:

A = A + 1

creates a new array for the result of the addition, places the sum into the new array, assigns it to A, and then frees the old allocation of A. Total storage required is twice the size of A. The statement:

A = TEMPORARY(A) + 1

requires no additional space.

Note: If the operation performed on Variable requires that Variable be converted to another data type, there is no benefit to using TEMPORARY. For instance, if the array A in the above example contained byte data rather than integer data, the array would have to be converted to integer type before the addition could be performed. In such a case, memory could not be re-used.

Syntax


Result = TEMPORARY(Variable)

Return Value


Returns a copy of a specified variable.

Arguments


Variable

The variable to be referenced and deleted.

Keywords


None.

Version History


Pre-4.0

Introduced

See Also


DELVAR



Notes


This page has no user notes yet. Be the first one!


This information is not subject to the controls of the International Traffic in Arms Regulations (ITAR) or the Export Administration Regulations (EAR). However, it may be restricted from transfer to various embargoed countries under U.S. laws and regulations.
© 2014 Exelis Visual Information Solutions