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

Home » Public Forums » archive » Q: Clear everything in IDL?
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
Q: Clear everything in IDL? [message #9895] Mon, 15 September 1997 00:00 Go to next message
htsang is currently offline  htsang
Messages: 14
Registered: September 1997
Junior Member
Anyone know of a way to clear everything (variables, values) in IDL?
Seems like there is no such command avaiable.

-- Herbert
Re: Q: Clear everything in IDL? [message #9936 is a reply to message #9895] Tue, 23 September 1997 00:00 Go to previous message
R. Bauer is currently offline  R. Bauer
Messages: 137
Registered: November 1996
Senior Member
Herbert Tsang wrote:
>
> Anyone know of a way to clear everything (variables, values) in IDL?
> Seems like there is no such command avaiable.
>
> -- Herbert


Yes,

This is my solution of this problem, it's a bit tricky.


The first step may be to identify which variables are defined.

vars=routine_names(variables=-1)


the next step should be to temporary each to dummy
like:

a=execute('dummy = temporary('+vars(i)+')')


but now to the routine,

it's decided as a main program or whithout the end at the end as
@ journal



======================================================

catch,errvar
IF errvar NE 0 THEN GOTO, help

zvars=routine_names(variables=-1)
a = n_elements(a) ; to undefine a
z = n_elements(z) ; to undefine z
zn=n_elements(zvars)-1

for z=0,zn do begin
varvalue=routine_names(zvars(z),fetch=-1)
IF n_elements(varvalue) GT 0 THEN begin
exec = 'dummy = temporary('+zvars(z)+')
print,exec
a = execute(exec)
ENDIF
ENDFOR

IF n_elements(exec) GT 0 THEN dummy = temporary(exec)
IF n_elements(a) GT 0 THEN dummy = temporary(a)
IF n_elements(z) GT 0 THEN dummy = temporary(z)
IF n_elements(zvars) GT 0 THEN dummy = temporary(zvars)
IF n_elements(zn) GT 0 THEN dummy = temporary(zn)
IF n_elements(varvalue) GT 0 THEN dummy = temporary(varvalue)


help: print,'all deleted'

END


============================================================ ===

limitations:

The first time running it clears all variables.

all other runnings it will only clear previously defined / undefined
variables.
WHY - I don't know!




R.Bauer


--
R.Bauer

Institut fuer Stratosphaerische Chemie (ICG-1)
Forschungszentrum Juelich
email: R.Bauer@fz-juelich.de
Re: Q: Clear everything in IDL? [message #9939 is a reply to message #9895] Tue, 23 September 1997 00:00 Go to previous message
R. Bauer is currently offline  R. Bauer
Messages: 137
Registered: November 1996
Senior Member
Herbert Tsang wrote:

Anyone know of a way to clear everything (variables, values) in IDL?
Seems like there is no such command avaiable.

-- Herbert



I did a mistake in the previously posted version thats the new one.

Yes,

This is my solution of this problem, it's a bit tricky.

The first step may be to identify which variables are defined.

vars=routine_names(variables=-1)

the next step should be to temporary each to dummy
like:

a=execute('dummy = temporary('+vars(i)+')')

but now to the routine,

it's decided as a main program or whithout the end at the end as
@ journal

======================================================

catch,errvar
IF errvar NE 0 THEN GOTO, help

zvars=routine_names(variables=-1)
a = n_elements(a) ; to undefine a
z = n_elements(z) ; to undefine z
zn=n_elements(zvars)-1

for z=0,zn do begin
varvalue=routine_names(zvars(z),fetch=-1)
IF n_elements(varvalue) GT 0 THEN begin
exec = 'dummy = temporary('+zvars(z)+')
print,exec
a = execute(exec)
ENDIF
ENDFOR

help: print,'all deleted'

IF n_elements(exec) GT 0 THEN dummy = temporary(exec)
IF n_elements(a) GT 0 THEN dummy = temporary(a)
IF n_elements(z) GT 0 THEN dummy = temporary(z)
IF n_elements(zvars) GT 0 THEN dummy = temporary(zvars)
IF n_elements(zn) GT 0 THEN dummy = temporary(zn)
IF n_elements(varvalue) GT 0 THEN dummy = temporary(varvalue)


END

============================================================ ===

limitations:

The first time running it clears all variables.

all other runnings it will only clear previously defined / undefined
variables.
WHY - I don't know!

R.Bauer

--
R.Bauer

Institut fuer Stratosphaerische Chemie (ICG-1)
Forschungszentrum Juelich
email: R.Bauer@fz-juelich.de
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Callable IDL
Next Topic: Re: window colour maps

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

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

Total time taken to generate the page: 0.00472 seconds