IDL_Savefile use [message #79703] |
Wed, 28 March 2012 09:26  |
desertdryad
Messages: 39 Registered: August 2011
|
Member |
|
|
I am trying to use the IDL_Savefile class within a procedure, which
needs to restore structure variables that I've previously saved to
file using 'SAVE'. This works fine - to a point. I can restore the
variable, but I can't figure out how to programmatically reference the
variable I've just restored!
Here is a bit of code :
sObj = OBJ_NEW('IDL_Savefile', structurefile)
sinfo = sObj->Contents()
print, 'struct contents are :', sinfo
sName = sObj->Names()
print, 'saved structures name is :', sName
RESTORE, sName, /VERBOSE
.. which all does what I expect, but I afterwards want to reference
the structure variable that is contained as a strong in 'SName'. How
I do that? Ie, the below does not work:
tag_idx = WHERE(TAG_NAMES(sName) EQ STRUPCASE(thevariable), count)
because 'sName' is a string containing the name of my structure not
the variable itself. How can I programmatically get at the variable,
without passing the name to the procedure? (which to me defeats the
purpose of Names() altogether) I must be missing something incredibly
simple... which would be easy, since I'm not terribly good at object
based programming in IDL.
thanks,
Cyndy
|
|
|