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

Home » Public Forums » archive » Re: Deleting Variables
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: Deleting Variables [message #11614] Fri, 24 April 1998 00:00 Go to previous message
thompson is currently offline  thompson
Messages: 584
Registered: August 1991
Senior Member
lundblad@ugastro.berkeley.edu (Nathan Lundblad) writes:


> How does one delete variable in IDL?

> I know _delvar_, but that only works on the
> main level of the program, and only one on
> variable. I want to purge everything.

> Also, how would one delete a common block?

I don't think one can delete an entire common block. However, here is simple
routine that can delete any variable, even those in subroutines or common
blocks. Actually, it sets them to undefined, which is almost the same thing.

Bill Thompson

============================================================ ===================
pro delvarx, p0,p1,p2,p3,p4,p5,p6,p7,p8,p9
;
;+
;
; Project: SSW
;
; Name: delvarx
;
; Purpose: delete variables for memory management (can call from routines)
;
; Input Parameters:
; p0,p1...p9 - variables to delete
;
; Calling Sequence:
; delvarx, a [,b,c,d,e,f,g,h,i,j] ;deletes named variables
; ;like idl delvar, but may be used
; ;from any calling level
;
; History:
; S.L.Freeland 25-feb-1993 ; Written
; slf, 8-mar-1993 ; bug fix
; slf, 25-mar-1993 ; made it work for non-scalers!
; slf, 15-jan-1997 ; Documentataion->SSW
;
;
; Method: uses execute and temporary function
;-
for i=0, n_params()-1 do begin ;for each parameter
param=strcompress("p" + string(i),/remove)
; only delete if defined on inpu (avoids error message)
exestat = execute("defined=n_elements(" + param + ")" )
if defined gt 0 then begin
exestat = execute(param + "=0")
exestat = execute("dvar=temporary(" + param + ")" )
endif
endfor
return
end
[Message index]
 
Read Message
Read Message
Previous Topic: Satellite Image Data-Map Projection Question
Next Topic: Re: How to skip some bytes?

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

Current Time: Thu Oct 09 19:53:28 PDT 2025

Total time taken to generate the page: 0.00558 seconds