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

Home » Public Forums » archive » How to see if variable is defined?
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: How to see if variable is defined? [message #3404 is a reply to message #3359] Thu, 26 January 1995 12:28 Go to previous messageGo to previous message
zawodny is currently offline  zawodny
Messages: 121
Registered: August 1992
Senior Member
In article <3g8n7i$ghv@sun2.ruf.uni-freiburg.de> ps@kis.uni-freiburg.de (Peter Suetterlin) writes:
> Mike Schienle (rep2857@sbsun0010.sbrc.hac.com) wrote:
> : IDL> print, var
> : % PRINT: Variable is undefined: VAR.
> : % Execution halted at $MAIN$ (PRINT).
> : IDL> print, size(var)
> : 0 0 1
>
> : The first parameter will be a zero if var is undefined.
>
> !!NO
>
> that's wrong:
> IDL> i=1
> IDL> print,size(i)
> 0 2 1
> IDL>
>
> The *second* parameter has to be zero (exactly s(s(0)+1, which defines
> the type of the variable)


I've noticed that this thread has survived longer than I would
anticipate from the subject. I have not been following it so, this may have
been pointed out already.

I use the following:

if(n_elements(var) eq 0) then print,'Variable is undefined'

This is much easier to remember and is less code than using SIZE.

--
Joseph M. Zawodny (KO4LW) NASA Langley Research Center
Internet: j.m.zawodny@larc.nasa.gov MS-475, Hampton VA, 23681-0001
TCP/IP: ko4lw@ko4lw.ampr.org Packet: ko4lw@n4hog.va.usa.na
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: autostart Wave license, Solaris 2.4
Next Topic: "True" map projections

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

Current Time: Wed Oct 08 18:55:28 PDT 2025

Total time taken to generate the page: 0.00449 seconds