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

Home » Public Forums » archive » Re: accessing variables with their string names
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: accessing variables with their string names [message #10667 is a reply to message #10664] Fri, 19 December 1997 00:00 Go to previous messageGo to previous message
davidf is currently offline  davidf
Messages: 2866
Registered: September 1996
Senior Member
Natalie Rooney (natalie@arlut.utexas.edu) writes:

> Hello. I'm trying to create a graphical user interface to do analysis
> and plotting of research data. My widget contains a list widget where I
> display the names of the data the user has read in.
>
> The problem is: I wanted the user to be able to read in a dat file of
> saved variables. I don't know what the names of the variables will
> necessarily be. I figured out a way to get the STRING names of the
> restored variables into an array. But, I still need a way to access the
> data that the variables contain for plots, etc. Is there any way to
> access the variables' data if all you have is a string array of the
> variables' names? I'd appreciate any help.

Uuggh. It is *possible*, maybe, but you will probably run
into limitations. For example, you will have to name
all the "variables" something else in your program to use
them. Here is a short example of how I might approach the
problem using the EXECUTE command. I don't know any other
way that this could be accomplished, really.

Pro Example, varNames
Restore, 'example.sav'
ok = Execute('Plot, ' + varNames[0])
ok = Execute('var2 = ' + varNames[1])
Help, var2
END

a = Findgen(11)
b = 3.5
Save, a, b, File='example.sav'
Example, ['a', 'b']
END

How are you getting the "string" names of the restored
variables?

Happy Holidays,

David

-----------------------------------------------------------
David Fanning, Ph.D.
Fanning Software Consulting
E-Mail: davidf@dfanning.com
Phone: 970-221-0438
Coyote's Guide to IDL Programming: http://www.dfanning.com/
[Message index]
 
Read Message
Read Message
Read Message
Previous Topic: Vim 5 language syntax file for IDL wanted
Next Topic: bits from bytes

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

Current Time: Fri Oct 10 12:56:07 PDT 2025

Total time taken to generate the page: 0.64733 seconds