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

Home » Public Forums » archive » Re: convert string into the name of a variable
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: convert string into the name of a variable [message #28397 is a reply to message #28387] Wed, 05 December 2001 15:31 Go to previous messageGo to previous message
thompson is currently offline  thompson
Messages: 584
Registered: August 1991
Senior Member
Frederic Raison <frederic_raison@hotmai.com> writes:

> Hi!

> Is there anybody who could tell me if there is an IDL instruction, like
> in Matlab, able to convert a string into the name of a variable and
> vice-versa? I mean if I have defined :

> a=1
> b=2
> list=['a','b']


> I would like to write:

> print,somme_instruction(list[0])

> and to get:

> 1

> Thank you

> Frederic

The easiest way I can think of to do this would be

test=execute('print,'+list[0])

William Thompson
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: I have committed a sin CONGRID
Next Topic: Plotting data spanning multiple UTM zones

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

Current Time: Thu Oct 16 18:05:34 PDT 2025

Total time taken to generate the page: 0.16079 seconds