Re: IDL variables [message #36041 is a reply to message #36040] |
Thu, 07 August 2003 16:36  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Denis Barkats writes:
> I am new to this newsgroup posting thingy.
> I would like to know if there is a way to get IDL to just print the
> variables in its memory without having to also print all the used
> functions and procdures. I 've tried typing : help but that always
> returns a lot of other things.
OK, here is a routine that does this, but it is
totally illegal, bogus, etc., and you didn't get
it from me. :-(
You will need my UNDEFINE program to make it work
elegantly. If you don't need elegance, just delete
that line.
;****************************************************
PRO Help_Var
; Just print out the damn variables!
names = ROUTINE_NAMES(Variables=1)
FOR j=0, N_Elements(names) - 1 DO BEGIN
IF N_Elements(ROUTINE_NAMES(names[j], FETCH=1)) GT 0 THEN BEGIN
value = ROUTINE_NAMES(names[j], FETCH=1)
HELP, value, Output=s
UnDefine, value
Print, StrUpCase(names[j]) + StrMid(s, 6)
ENDIF
ENDFOR
END
;****************************************************
> The reason is that I would like to be able to delete variables fast.
> For exemple, get a list of the varaibles names and delete all the
> ones that start with the letter s.
Yeah, well, if you need to do this, I'd guess the chances
are probably better than even you need some work on
your programming style. :-)
But I leave it as an exercise for the reader to develop
a method that can use regular expressions to search out
variables for deletion. I can't think of a way. I'm
pretty sure that even this hocus-pocus isn't strong
enough magic to do it.
> PS: and Oh, if D. Fanning reads this, I must already thank him
> enourmously for all the tips and programs on his web page withouty
> which I would not be finishing my thesis. Thanks
Oogh. This makes all the effort worthwhile! Thanks. :-)
Cheers,
David
--
David W. Fanning, Ph.D.
Fanning Software Consulting, Inc.
Phone: 970-221-0438, E-mail: david@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155
|
|
|