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

Calling Sequence

Result = REPLICATE( Value, D 1 [, ..., D n ] )



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.

D i

The dimensions of the result.


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)

See Also