Re: Retrieving elements of function returns [message #41813] |
Thu, 25 November 2004 05:43 |
Ben Panter
Messages: 102 Registered: July 2003
|
Senior Member |
|
|
Paolo Grigis wrote:
> This is documented in the manual "Building IDL Applications",
> Chapter 6, Section Array Subscripts, p.123 in the IDL 6.0 version.
Thanks Paolo, David -- that's great news.\
Ben
--
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Ben Panter, Garching, Germany
email via www.benpanter.co.uk
|
|
|
Re: Retrieving elements of function returns [message #41815 is a reply to message #41813] |
Thu, 25 November 2004 05:03  |
Paolo Grigis
Messages: 171 Registered: December 2003
|
Senior Member |
|
|
Ben Panter wrote:
> Hello All,
>
> Bit of an odd request this. I've recently found that I can take the
> nth element of a returned array by enlosing the function in brackets and
> then appending an array subscript:
>
> n_pix=(size(grid))[1]
>
> which is a bit neater than
>
> n_pix=size(grid)
> n_pix=n_pix[1]
>
> I've had a look though the online help, and I can't decide if this is a
> reasonable thing to do or not -- primarily I'm concerned that this is
> some sort of undocumented feature which may disappear in later versions.
>
> Can someone reassure me that it's ok?!
This is documented in the manual "Building IDL Applications",
Chapter 6, Section Array Subscripts, p.123 in the IDL 6.0 version.
Ciao,
Paolo
>
> Cheers,
>
> Ben
>
--
____________________________________________________________ ________
Paolo Grigis
ETHZ - Institute of Astronomy email: pgrigis@astro.phys.ethz.ch
Scheuchzerstrasse 7
ETH Zentrum phone: ++41 1 632 42 20
8092 Zurich fax : ++41 1 632 12 05
Switzerland http://www.astro.phys.ethz.ch/
____________________________________________________________ ________
|
|
|
Re: Retrieving elements of function returns [message #41816 is a reply to message #41815] |
Thu, 25 November 2004 05:03  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Ben Panter writes:
> Bit of an odd request this. I've recently found that I can take the
> nth element of a returned array by enlosing the function in brackets and
> then appending an array subscript:
>
> n_pix=(size(grid))[1]
>
> which is a bit neater than
>
> n_pix=size(grid)
> n_pix=n_pix[1]
>
> I've had a look though the online help, and I can't decide if this is a
> reasonable thing to do or not -- primarily I'm concerned that this is
> some sort of undocumented feature which may disappear in later versions.
>
> Can someone reassure me that it's ok?!
Oh, this is perfectly OK, although the syntax does become
a bit C-ish for some people's taste. :-)
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
|
|
|