The REPLICATE function returns an array with the given dimensions, filled with the scalar value specified as the first parameter.

Examples


Create D, a 5-element by 5-element array with every element set to the string “IDL” by entering:

D = REPLICATE('IDL', 5, 5)

REPLICATE can also be used to create arrays of structures. For example, the following command creates a structure named “emp” that contains a string name field and a long integer employee ID field:

employee = {emp, NAME:' ', ID:0L}

To create a 10-element array of this structure, enter:

emps = REPLICATE(employee, 10)

Syntax


Result = REPLICATE( Value, D1[, ..., D8] )

Return Value


Returns the array of the given dimensions.

Arguments


Value

The scalar value with which to fill the resulting array. The type of the result is the same as that of Value. Value can be any single element expression such as a scalar or 1 element array. This includes structures.

Di

Either an array or a series of scalar expressions specifying the dimensions of the result. If a single argument is specified, it can be either a scalar expression or an array of up to eight elements. If multiple arguments are specified, they must all be scalar expressions. Up to eight dimensions can be specified.

Keywords


Thread Pool Keywords

This routine is written to make use of IDL’s thread pool, which can increase execution speed on systems with multiple CPUs. The values stored in the !CPU system variable control whether IDL uses the thread pool for a given computation. In addition, you can use the thread pool keywords TPOOL_MAX_ELTS, TPOOL_MIN_ELTS, and TPOOL_NOTHREAD to override the defaults established by !CPU for a single invocation of this routine. See Thread Pool Keywords for details.

Version History


Original

Introduced

See Also


MAKE_ARRAY