[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

REPLICATE with arrays



I often have the need to replicate an array, but IDL's replicate only
works with scalars.  Does anyone have any tips on the most efficient,
simplest, clearest (you choose) way to do this?

e.g.

I have:
help, x
    INT    = Array[3, 3]
print, x
    2    4    10
    3    7    5
    3    9    2

and would like to do:
x2 = replicate(x,2)
help, x2
    INT    = Array[3, 3, 2]
print, x2
    2    4    10
    3    7    5
    3    9    2

    2    4    10
    3    7    5
    3    9    2

I've figured out some trick for 1 and 2 dimensional arrays, but I'm
looking for a more general strategy to use on higher dim arrays.

Thanks,

Vince