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 #28400 is a reply to message #28397] Wed, 05 December 2001 14:47 Go to previous message
Paul van Delst is currently offline  Paul van Delst
Messages: 364
Registered: March 1997
Senior Member
Frederic Raison wrote:
>
> 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

this'll get yer started

IDL> a=149
IDL> b=273
IDL> list=['a','b']
IDL> result=execute('print,'+list[0])
149
IDL> result=execute('print,'+list[1])
273

if the execute works, result = 1.

--
Paul van Delst Religious and cultural
CIMSS @ NOAA/NCEP purity is a fundamentalist
Ph: (301)763-8000 x7274 fantasy
Fax:(301)763-8545 V.S.Naipaul
[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: Sun Oct 12 12:19:39 PDT 2025

Total time taken to generate the page: 1.52390 seconds