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

Home » Public Forums » archive » Preferred way to get multiple returns from a function
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Preferred way to get multiple returns from a function [message #75036] Fri, 11 February 2011 15:32
James[2] is currently offline  James[2]
Messages: 44
Registered: November 2009
Member
I am writing a function that fits an ellipse to a 2*N array of
points. There are three values to return: the center, semi-major
axis, and semi-minor axis. This is a simple program, but it brings up
a more general question: what is the preferred IDL way to return
multiple values from a function?

Currently, my program returns a structure containing the elements
{center, major, minor}. However, a lot of built-in IDL routines take
named variable inputs that are set to the appropriate value on output
- so instead of something like:

ellipse_struct = fit_ellipse(points)

I would have:

fit_ellipse, points, center, major, minor

I'm not sure which is better. C programming has taught me to
appreciate structures, but I'd like to code in the conventions of the
language. Which would you prefer, and why?
[Message index]
 
Read Message
Previous Topic: Re: Market Research 101
Next Topic: Re: Pre-Publication Release of New Book

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

Current Time: Thu Oct 09 11:47:45 PDT 2025

Total time taken to generate the page: 0.80215 seconds