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

Home » Public Forums » archive » Re: Undocumented array indexing feature?
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: Undocumented array indexing feature? [message #14113 is a reply to message #14112] Thu, 21 January 1999 00:00 Go to previous message
Craig Markwardt is currently offline  Craig Markwardt
Messages: 1869
Registered: November 1996
Senior Member
Liam Gumley <Liam.Gumley@ssec.wisc.edu> writes:
>
> Here's a way to index an array I hadn't seen before:
>
> a = indgen(10,10)
> x = [3,5,8,9]
> y = [2,7]
> print, (a[x,*])[*,y]
> 23 25 28 29
> 73 75 78 79
>
> Does anyone know where this feature (i.e. enclosing an array with
> parentheses and appending an index) is documented? I couldn't find it in
> my printed IDL 5.0 documentation.

It's not really an array indexing feature per se. In your example, a
temporary expression is first created from a[x,*], and then *that*
temporary expression is indexed according to [*,y]. Internally, IDL
must do some more copying than straight array indexing, so your
operation is not as efficient. On the other hand it probably does
what you want. I like it!

By the way, indexing of expressions is allow, as long as you throw a
pair of parentheses around it. The following sometimes appears in my
code:

n = (size(x))[0]

The result of size(x) is an array; this statement takes the first
element of that array.

Craig


--
------------------------------------------------------------ --------------
Craig B. Markwardt, Ph.D. EMAIL: craigmnet@astrog.physics.wisc.edu
Astrophysics, IDL, Finance, Derivatives | Remove "net" for better response
------------------------------------------------------------ --------------
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: how do i read compressed tiff files?
Next Topic: Re: Processing Audio

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

Current Time: Wed Oct 08 17:17:28 PDT 2025

Total time taken to generate the page: 0.00453 seconds