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

Home » Public Forums » archive » Re: array subscripts
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: array subscripts [message #12847] Fri, 18 September 1998 00:00
Martin Schultz is currently offline  Martin Schultz
Messages: 515
Registered: August 1997
Senior Member
Kevin Ivory wrote:
>
>> Martin Schultz (mgs@io.harvard.edu) writes:
>>> PPS: And while we are at it... One of the most useful tips I got from
>>> David's book (so far) was the A[n:*] syntax to extract ranges from n to
>>> end. I am really grateful for this!
>
> David Fanning wrote:
>> I've been using this for so long I can't really remember
>> where I learned it, but I suspect it was from Ray Sterner's
>> unpublished (so far) IDL manuscript. He has dozens of
>> useful subscripting tips like this. :-)
>
> Perhaps you read the IDL manual? The book 'Building IDL Applications'
> has a chapter about 'Array Subscripts' with a section about 'Subscript
> Ranges'. ;-)
>
> By the way, the book is online:
> ftp://ftp.rsinc.com/pub/idl_5.1.1/info/docs/building.pdf
> See page 62.
>
> Cheers,
> Kevin

Thanks for pointing me to the right manual, Kevin. As I now understand,
the idea behind passing two or more "explicit" index arrays as
subscripts is to extract individual elements of an array, not a
rectangular domain.

Hence, A=FINDGEN(10,10)
B=A[ [1,2,3],[4,5,6] ]
returns A1,4 , A2,5 , and A3,6

whereas C=A[ [1,2,3], 4:6 ]
returns A1,4 A2,4 A3,4
A1,5 A2,5 A3,5
A1,6 A2,6 A3,6
(or the transposed form?)

I guess, this is one of those cases, where one gets into the habit of
certain things, and then you start wondering why things are not laid out
the way you need them. I must recognize, there are other people using
IDL for different purposes than me ;-)

Thanks again,
Martin.

--
------------------------------------------------------------ -------
Dr. Martin Schultz
Department for Earth&Planetary Sciences, Harvard University
109 Pierce Hall, 29 Oxford St., Cambridge, MA-02138, USA

phone: (617)-496-8318
fax : (617)-495-4551

e-mail: mgs@io.harvard.edu
Internet-homepage: http://www-as.harvard.edu/people/staff/mgs/
------------------------------------------------------------ -------
Re: array subscripts [message #12850 is a reply to message #12847] Fri, 18 September 1998 00:00 Go to previous message
davidf is currently offline  davidf
Messages: 2866
Registered: September 1996
Senior Member
Kevin Ivory (Kevin.Ivory@linmpi.mpg.de) writes:

> Perhaps you read the IDL manual? The book 'Building IDL Applications'
> has a chapter about 'Array Subscripts' with a section about 'Subscript
> Ranges'. ;-)

Perhaps. But like most IDL users, I consider IDL so intuitively
easy to use that reading the manuals is probably a waste
of time. :^)

Actually, that is not quite true. I use the on-line help
a LOT. In fact, I probably use it more now (when I am
suppose to be an IDL "expert") than I did when I didn't
have a clue. But, I have to admit, the IDL documentation is
not the first thing that comes to mind when I think of
"pleasure reading". :-)

Cheers,

David

P.S. To be completely serious for a moment. I find the
IDL documentation to be MUCH better organized and
easier to use than it used to be. Although it is still
written a little too much from a computer software-centric
point of view for my taste (and needs), it is generally
on par with most of the documentation sitting on my shelf.

----------------------------------------------------------
David Fanning, Ph.D.
Fanning Software Consulting
E-Mail: davidf@dfanning.com
Phone: 970-221-0438, Toll-Free Book Orders: 1-888-461-0155
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Re: array subscripts [message #12852 is a reply to message #12847] Fri, 18 September 1998 00:00 Go to previous message
Kevin Ivory is currently offline  Kevin Ivory
Messages: 71
Registered: January 1997
Member
> Martin Schultz (mgs@io.harvard.edu) writes:
>> PPS: And while we are at it... One of the most useful tips I got from
>> David's book (so far) was the A[n:*] syntax to extract ranges from n to
>> end. I am really grateful for this!

David Fanning wrote:
> I've been using this for so long I can't really remember
> where I learned it, but I suspect it was from Ray Sterner's
> unpublished (so far) IDL manuscript. He has dozens of
> useful subscripting tips like this. :-)

Perhaps you read the IDL manual? The book 'Building IDL Applications'
has a chapter about 'Array Subscripts' with a section about 'Subscript
Ranges'. ;-)

By the way, the book is online:
ftp://ftp.rsinc.com/pub/idl_5.1.1/info/docs/building.pdf
See page 62.

Cheers,
Kevin
--
Kevin Ivory Tel: +49 5556 979 434
Max-Planck-Institut fuer Aeronomie Fax: +49 5556 979 240
Max-Planck-Str. 2 mailto:Kevin.Ivory@linmpi.mpg.de
D-37191 Katlenburg-Lindau, GERMANY http://www.gwdg.de/~kivory2/
Re: array subscripts [message #12862 is a reply to message #12847] Thu, 17 September 1998 00:00 Go to previous message
davidf is currently offline  davidf
Messages: 2866
Registered: September 1996
Senior Member
Martin Schultz (mgs@io.harvard.edu) writes:

> PPS: And while we are at it... One of the most useful tips I got from
> David's book (so far) was the A[n:*] syntax to extract ranges from n to
> end. I am really grateful for this!

I've been using this for so long I can't really remember
where I learned it, but I suspect it was from Ray Sterner's
unpublished (so far) IDL manuscript. He has dozens of
useful subscripting tips like this. :-)

Cheers,

David

----------------------------------------------------------
David Fanning, Ph.D.
Fanning Software Consulting
E-Mail: davidf@dfanning.com
Phone: 970-221-0438, Toll-Free Book Orders: 1-888-461-0155
Coyote's Guide to IDL Programming: http://www.dfanning.com/
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: Setting ranges on surfaces
Next Topic: Re: The Clinton, Starr Report in FULL

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

Current Time: Fri Oct 10 23:09:38 PDT 2025

Total time taken to generate the page: 0.88578 seconds