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 #10664] Fri, 19 December 1997 00:00 Go to previous message
Martin Schultz is currently offline  Martin Schultz
Messages: 515
Registered: August 1997
Senior Member
Natalie Rooney wrote:
>
> 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.
>
> Thanks,
> Natalie Rooney


If I understand you correctly, all you need is something like
timeind = where(names eq 'TIME')
ind = where(names eq VARNAME)
if (ind(0) ge 0) then plot,data(timeind,*),data(ind,*)

Here data is the data array, and names stores the variable name strings.
In the example above, data has the dimension (M,N), with M variable
names and N observations.

You can get the VARNAME from the widget via the following procedure:
; get names and selection of x or y list
widget_control,widget_id,get_value=names
; determine selection in x or y list
; (requires knowledge of the structure of cw_xysel !!)
widget_control,widget_info(widget_id,/child),get_uvalue=xyst ate
sel = widget_info(xystate.listID,/list_select)
This is actually a piece of code from my EXPLORE widget application.
You may want to check my web page for this, and if you like the general
idea, I am sure you can find a handful of information with respect to
what you are trying to do if you take a look at the sources.

Regards,
Martin.


--
------------------------------------------------------------ -------
Dr. Martin Schultz
Department for Earth&Planetary Sciences, Harvard University
186 Pierce Hall, 29 Oxford St., Cambridge, MA-02138, USA

phone: (617)-496-8318
fax : (617)-495-4551

e-mail: mgs@io.harvard.edu
IDL-homepage: http://www-as.harvard.edu/people/staff/mgs/idl/
------------------------------------------------------------ -------
[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: Wed Oct 08 17:39:50 PDT 2025

Total time taken to generate the page: 0.00551 seconds