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 #14105 is a reply to message #14104] Fri, 22 January 1999 00:00 Go to previous messageGo to previous message
J.D. Smith is currently offline  J.D. Smith
Messages: 214
Registered: August 1996
Senior Member
Liam Gumley wrote:
>
> Liam Gumley wrote:
>> 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.
>
> To answer my own question, a careful reading of Chapter 5 of 'Building
> IDL Applications' p. 60
> (ftp://ftp.rsinc.com/pub/idl_5.2/info/docs/building.pdf)
> revealed the following:
>
> "The syntax of a subscript reference is:
> Variable_Name[Subscript_ List]
> or
> (Array_Expression)[Subscript_List]"
>
> Thanks to Bill and Craig for their replies.
>

Array indexing isn't the only place parentheses are useful...

try this sometime:

a=(b=(c=1))

Basically, parentheses just instruct the command parser to iterate as
many times as necessary to remove them all. Other examples:

print,(x=5)

It doesn't work for everything though... as evidenced by:

z=5+6*(y=8)


JD

--
J.D. Smith |*| WORK: (607) 255-5842
Cornell University Dept. of Astronomy |*| (607) 255-6263
304 Space Sciences Bldg. |*| FAX: (607) 255-5875
Ithaca, NY 14853 |*|
[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 19:21:04 PDT 2025

Total time taken to generate the page: 0.00356 seconds