[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Problem array subscripting
- To: GRI <dibeas(at)etsit.upm.es>
- Subject: Re: Problem array subscripting
- From: Henry Chapman <chapman9(at)llnl.gov>
- Date: Tue, 17 Aug 1999 15:39:06 -0700
- Newsgroups: comp.lang.idl-pvwave
- Organization: LLNL
- References: <37B7FF76.F5062466@etsit.upm.es>
- Xref: news.doit.wisc.edu comp.lang.idl-pvwave:16158
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