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

Home » Public Forums » archive » Re: Returning > 1 variable with functions?
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: Returning > 1 variable with functions? [message #37450] Wed, 17 December 2003 04:24
robert.dimeo is currently offline  robert.dimeo
Messages: 42
Registered: November 2001
Member
"Jonathan Greenberg" <greenberg@ucdavis.edu> wrote in message news:<I7PDb.40771$bK7.28491@newssvr29.news.prodigy.com>...
> Is there any way to write and call a function that returns more than one
> variable? The variables are arrays of different sizes, so merging them into
> a single array is an ugly way of doing it... help!
>
> --j

You can return a structure whose fields contain any type of variable.
Re: Returning > 1 variable with functions? [message #37454 is a reply to message #37450] Wed, 17 December 2003 01:56 Go to previous message
R.Bauer is currently offline  R.Bauer
Messages: 1424
Registered: November 1998
Senior Member
Jonathan Greenberg wrote:
> Is there any way to write and call a function that returns more than one
> variable? The variables are arrays of different sizes, so merging them into
> a single array is an ugly way of doing it... help!
>
> --j
>
>

Why not returning a structure, or a pointer

return, {x:1,y:2,z:3}

ptr=ptr_new({x:1,y:2,z:3})
return, ptr

Reimar

--
Reimar Bauer

Institut fuer Stratosphaerische Chemie (ICG-I)
Forschungszentrum Juelich
email: R.Bauer@fz-juelich.de
------------------------------------------------------------ -------
a IDL library at ForschungsZentrum Juelich
http://www.fz-juelich.de/icg/icg-i/idl_icglib/idl_lib_intro. html
============================================================ =======
Re: Returning > 1 variable with functions? [message #37455 is a reply to message #37454] Tue, 16 December 2003 21:31 Go to previous message
mmeron is currently offline  mmeron
Messages: 44
Registered: October 2003
Member
In article <I7PDb.40771$bK7.28491@newssvr29.news.prodigy.com>, "Jonathan Greenberg" <greenberg@ucdavis.edu> writes:

> Is there any way to write and call a function that returns more than one
> variable? The variables are arrays of different sizes, so merging them into
> a single array is an ugly way of doing it... help!
>
You can return as many variables as you wish, through keywords.

Mati Meron | "When you argue with a fool,
meron@cars.uchicago.edu | chances are he is doing just the same"
Re: Returning > 1 variable with functions? [message #37457 is a reply to message #37455] Tue, 16 December 2003 18:32 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Jonathan Greenberg writes:

> Is there any way to write and call a function that returns more than one
> variable? The variables are arrays of different sizes, so merging them into
> a single array is an ugly way of doing it... help!

I'd return them in keywords. :-)

Cheers,

David
--
David W. Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http:/www.dfanning.com/
Phone: 970-221-0438, IDL Book Orders: 1-888-461-0155
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: passing parameters in widgets
Next Topic: Starting to make progress with FFTW3 DLM...

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

Current Time: Wed Oct 08 19:20:37 PDT 2025

Total time taken to generate the page: 0.00545 seconds