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.

Calling Sequence

REPLICATE_INPLACE, X, Value [, D1, Loc1 [, D2, Range]]



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 optional parameter indicating which dimension of X is to be updated.


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.


An optional parameter, indicating in which dimension of X a group of one-dimensional subvectors are to be updated. D2 should be different from D1 .


An array of indices of dimension D2 of X , indicating where to put one-dimensional updates of X .


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.)

See Also