The REPLICATE_INPLACE procedure updates an existing array by replacing all or selected parts of it with a specified value. REPLICATE_INPLACE can be faster and use less memory than the IDL function REPLICATE or the IDL array notation for large arrays that already exist.

**NOTE: **
REPLICATE_INPLACE is much faster when operating on entire arrays and rows, than when used on columns or higher dimensions.

The array to be updated. *
X*
can be of any scalar numeric type. REPLICATE_INPLACE does not change the size and type of *
X*
.

The scalar value which will fill all or part of *
X*
. *
Value*
may be any scalar type that IDL can convert to the type of *
X*
. REPLICATE_INPLACE does not change *
Value*
.

An array with the same number of elements as the number of dimensions of *
X*
. The *
Loc1 *
and *
D1*
arguments together determine which one-dimensional subvector (or subvectors, if *
D1*
and *
Range*
are provided) of *
X*
is to be updated.

A = FLTARR( 40, 90, 10)*;
Create a multidimensional zero array.*

REPLICATE_INPLACE, A, 4.5*;
Populate it with the value 4.5. (i.e., A[*]= 4.5 )*

REPLICATE_INPLACE, A, 20, 1, [0,4,0]*;
Update a single subvector.
(i.e., A[*,4,0]= 20. )*

REPLICATE_INPLACE, A, -8, 3, [0,0,0], 2, [0,5,89]

*;
Update a group of subvectors.
(i.e., A[ 0, [0, 5,89], * ] = -8 )*

REPLICATE_INPLACE, A, 0., 3, [9,0,0] , 2, LINDGEN(90)

*;
Update a 2-dimensional slice of A (i.e., A[9,*, *] = 0.)*