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

Home » Public Forums » archive » Re: Object programming with data...
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: Object programming with data... [message #30857 is a reply to message #30856] Sun, 19 May 2002 14:12 Go to previous messageGo to previous message
Craig Markwardt is currently offline  Craig Markwardt
Messages: 1869
Registered: November 1996
Senior Member
Randall Skelton <rhskelto@atm.ox.ac.uk> writes:
> On a slightly different topic, is it possible to define a function that
> takes an arbitrary number of parameters? i.e. how do I write a function
> 'sum' that takes 'n' variables and sums them? (yes, in this case I could
> use 'total' but that's not the point...)

No fair slipping this at the end of an unrelated post! I usually
don't read David's "gosh golly" articles :-)

The answer to your question is no, and yes. No, there is no construct
in IDL that makes handling an arbitrary number of arguments easy. On
the other hand, yes, it is possible to parse them if you specify all
the parameters explicitly, as in,

PRO MYTOTAL, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10

and so on up to the maximum of 64 (?). Then you access them using the
EXECUTE() function.

for i = 0, n_params()-1 do begin
dummy = execute('x = x + x'+strtrim(i,2))
endfor


Craig

--
------------------------------------------------------------ --------------
Craig B. Markwardt, Ph.D. EMAIL: craigmnet@cow.physics.wisc.edu
Astrophysics, IDL, Finance, Derivatives | Remove "net" for better response
------------------------------------------------------------ --------------
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Array Subscripting Puzzle
Next Topic: idl/idlde command line autocomplete

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

Current Time: Wed Oct 08 15:28:38 PDT 2025

Total time taken to generate the page: 0.00358 seconds