[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: checking if variable is defined

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