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

Home » Public Forums » archive » Re: Is n_params() supposed to behave this way?
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: Is n_params() supposed to behave this way? [message #16842 is a reply to message #16841] Mon, 23 August 1999 00:00 Go to previous messageGo to previous message
Liam Gumley is currently offline  Liam Gumley
Messages: 473
Registered: November 1994
Senior Member
Mirko Vukovic wrote:

> Consider the following code:
>
> pro sub1,arg1,arg2,arg3,arg4,arg5
> message,/info,string(n_params())
> return
> end
>
> pro sub,arg1,arg2,arg3,arg4,arg5
> message,/info,string(n_params())
> sub1,arg1,arg2,arg3,arg4,arg5
> end
>
> If at the command prompt I do
>
> sub,4
>
> IDL will print out
> IDL> sub,4
> % SUB: 1
> % SUB1: 5
>
> In sub1 all arguments except the first one are still undefined.

n_params() returns the number of non-keyword arguments passed (defined
or not) to a procedure or function.
n_elements(arg) will tell you if arg is defined.

I think a case statement is your best bet.

Cheers,
Liam.
[Message index]
 
Read Message
Read Message
Read Message
Previous Topic: exporting a Contour object
Next Topic: Re: Contour plot over 3D surface

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

Current Time: Sat Oct 11 11:54:00 PDT 2025

Total time taken to generate the page: 0.47984 seconds