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

Home » Public Forums » archive » checking if variable is defined
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
checking if variable is defined [message #24625] Wed, 11 April 2001 08:47 Go to next message
Dominik[1] is currently offline  Dominik[1]
Messages: 46
Registered: April 2001
Member
Helle there,

I would like to plot a variable, but only if it is existing. When the
Variable is undefined, nothing should happen. So I am searching for an
expression for the if statement. Does anybody know an expression like:
if ( vaiable_name existing) then...

Thanks

Dominik


--
_____________________________
Dominik Paul
dpaul@ukl.uni-freiburg.de
Universit�tsklinikum Freiburg
Abt. PET/Nuklearmedizin
Re: checking if variable is defined [message #24759 is a reply to message #24625] Thu, 12 April 2001 05:19 Go to previous message
Bernard Puc is currently offline  Bernard Puc
Messages: 65
Registered: January 1998
Member
Dominik wrote:
>
> Helle there,
>
> I would like to plot a variable, but only if it is existing. When the
> Variable is undefined, nothing should happen. So I am searching for an
> expression for the if statement. Does anybody know an expression like:
> if ( vaiable_name existing) then...


One way to do this is with the N_ELEMENTS() function:

if (n_elements( variable ) GT 0) then print,'Variable exists'

--
Bernard Puc AETC, INC.
bpuc@va.aetc.com 1225 Jefferson Davis Highway #800
(703) 413-0500 Arlington, VA 22202
Re: checking if variable is defined [message #24774 is a reply to message #24625] Wed, 11 April 2001 09:59 Go to previous message
davidf is currently offline  davidf
Messages: 2866
Registered: September 1996
Senior Member
Dominik (dpaul@ukl.uni-freiburg.de) writes:

> I would like to plot a variable, but only if it is existing. When the
> Variable is undefined, nothing should happen. So I am searching for an
> expression for the if statement. Does anybody know an expression like:
> if ( vaiable_name existing) then...

IF N_Elements(variable_name) NE 0 THEN doSomething

Cheers,

David

--
David Fanning, Ph.D.
Fanning Software Consulting
Phone: 970-221-0438 E-Mail: davidf@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: IDLWAVE 4.9
Next Topic: Re: R: How to call fortran subroution?

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

Current Time: Wed Oct 08 11:43:13 PDT 2025

Total time taken to generate the page: 0.00338 seconds