Re: Novice question. [message #22263] |
Thu, 26 October 2000 15:03 |
promashkin
Messages: 169 Registered: December 1999
|
Senior Member |
|
|
David Fanning wrote:
>
> Silly, but a time-worn pattern for many of us prior
> to IDL 5.3. :-)
I must admid that in 5.3 I am still using it to *make sure* everything
did really get reset :-( .Reset_* is still not quite doing it
completely. Hopefully, 5.4 has its implemented better.
Cheers,
Pavel
|
|
|
Re: Novice question. [message #22267 is a reply to message #22263] |
Thu, 26 October 2000 05:40  |
davidf
Messages: 2866 Registered: September 1996
|
Senior Member |
|
|
Randall Skelton (rhskelto@atm.ox.ac.uk) writes:
> I am fumbling around IDL 5.3 at the moment with an older version of the
> user's manual (circa 1992) but I'm having trouble locating the most basic
> of idl commands.
You might try reading (and printing, if you like) the
current manuals, which are shipped with all IDL
distributions. You can access all of the reference
material from the on-line help:
IDL> ?
All of the IDL manuals are in the docs directory
in the IDL distribution as PDF files. Of course,
there are better ways to learn about IDL programming
than reading the manuals. :-)
> I can set x=1.0 and y=2.0 at the command prompt but how do I then clear or
> reset the x and y variables after this?
You don't have to clear them. Just reset them to something else:
x = 5.0
y = 3.0
> Better still, how do I do this to
> all the variables which I've defined in a program/function?
If you mean by "program/function" an IDL procedure or
function, then you don't have to do this either. The
variables are reset each time you run the program.
I suspect, however, that you mean "main-level program",
which creates variables at the main-level. These are the
variables you might see when you type HELP at the IDL
prompt. These can be cleared in IDL 5.3 by typing
the .RESET_SESSION executive command:
IDL> .RESET_SESSION
> At the moment
> I just quit and restart but that seems rather silly...
Silly, but a time-worn pattern for many of us prior
to IDL 5.3. :-)
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
|
|
|
Re: Novice question. [message #22268 is a reply to message #22267] |
Thu, 26 October 2000 05:22  |
Peter Clinch
Messages: 98 Registered: April 1996
|
Member |
|
|
Randall Skelton wrote:
> I can set x=1.0 and y=2.0 at the command prompt but how do I then clear or
> reset the x and y variables after this? Better still, how do I do this to
> all the variables which I've defined in a program/function?
RTFM references you want are probably "delvar", ".reset_session" ;-)
Though note you can assign new values to variables without clearing them
first, as in most languages. Since IDL isn't particularly rigid with
types (i.e., easier to move between them, and easier to get weird errors
as a result of doing it by mistake!), you can set different types on the
fly, so...
IDL> x=1.0
IDL> help,x
X FLOAT = 1.00000
IDL> x=2
IDL> help,x
X INT = 2
IDL> delvar,x
IDL> help,x
X UNDEFINED = <Undefined>
IDL> x='hello'
IDL> y=x
IDL> help,x,y
X STRING = 'hello'
Y STRING = 'hello'
IDL> .reset_session
IDL> help,x,y
X UNDEFINED = <Undefined>
Y UNDEFINED = <Undefined>
HTH, Pete.
--
Peter Clinch University of Dundee
Tel 44 1382 660111 ext. 33637 Medical Physics, Ninewells Hospital
Fax 44 1382 640177 Dundee DD1 9SY Scotland UK
net p.j.clinch@dundee.ac.uk http://www.dundee.ac.uk/~pjclinch/
|
|
|