comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » array indices again
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
array indices again [message #15631] Thu, 03 June 1999 00:00 Go to previous message
Henry Chapman is currently offline  Henry Chapman
Messages: 10
Registered: February 1997
Junior Member
Hi all,

I remember a few weeks back there was a lot of discussion about indexing
multiple dimensions of arrays, and doing things such as

IDL> print,(a[x,*])[*,x]

I just noticed something that may or may not have come up in those
discussions (but I wasn't paying attention). It is most easily
explained by Liam's example of extracting every second row and column of
an array

IDL> a=indgen(10,10)
IDL> x=indgen(5)*2
IDL> print, a[x, x, 0]
0 2 4 6 8
20 22 24 26 28
40 42 44 46 48
60 62 64 66 68
80 82 84 86 88

It seems that by extending the 2-d array a into another dimension, where
the extra dimension has no size (sounds like string theory!) the
indexing works the way I want it to. I noticed this when I had a 3-d
array and was extracting a 2-d array from it, as in b[x, x, i] where x
is a 1-d array and i is a scalar. This seems to work on arrays of any
dimension.

I apologise if this was mentioned before,

Henry.


--
Henry Chapman mailto:chapman9@llnl.gov
Information Science & Technology Program
Lawrence Livermore National Lab
L-395, 7000 East Ave., Livermore CA 94550
[Message index]
 
Read Message
Read Message
Previous Topic: Re: IDL and Dual Processor PC's
Next Topic: Re: IDL interface to Oracle

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Fri Oct 10 13:39:35 PDT 2025

Total time taken to generate the page: 0.71964 seconds