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

Re: Problem array subscripting



This can be solved with a little trick I posted awhile back (some time
after a long thread about indices).  The trick is to index an extra
dimension.

Example:

IDL> array = bindgen(16,16,5)
IDL> index = indgen(5)
IDL> x = [0,1,2]
IDL> y = [8,9,10,11]

IDL> result = array[x, y, index, 0]

IDL> help,result
RESULT          BYTE      = Array[3, 4, 5]

IDL> print,result[*,*,0]
 128 129 130
 144 145 146
 160 161 162
 176 177 178

You could also do
IDL> result = array[x, y, *, 0]


Henry.
-- 
Henry Chapman                          mailto:chapman9@llnl.gov
Information Science & Technology Program
Lawrence Livermore National Lab 
L-395, 7000 East Ave., Livermore CA 94550