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

Home » Public Forums » archive » turn a string value into variable name
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: turn a string value into variable name [message #63141 is a reply to message #63041] Wed, 29 October 2008 06:34 Go to previous messageGo to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
loebasboy writes:

> On 23 okt, 23:56, David Fanning <n...@dfanning.com> wrote:
>> Nick writes:
>>> I am restoring over 100 .sav files and creating structures for
>>> analysis. =A0Each .sav represents a differenct scenario and ideally I
>>> would like to name the created structure in sequential format (case1,
>>> case2...casen).
>>
>>> To pull the data in I am using a for loop (all .sav have identical
>>> array names) and I'd like to use the counter to name the variable. =A0I=
> s
>>> it possible to turn a string into a variable name?
>>
>> The EXECUTE command can do this:
>
> Thank you David, I had the same question !

I'm glad the answer is helpful, but I would say in general
that 9 people out of 10 who are writing code like this
are *probably* doing the wrong thing. That is to say,
the good reasons for creating variables on the fly,
inside a procedure, are few and far between. I'd look
pretty hard for alternatives before I ever coded something
like this up.

Cheers,

David

--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: IDL-python bridge issue for MacOS Sierra 10.12.2 (Library not loaded: libpython2.7.dylib)
Next Topic: Image registration

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

Current Time: Fri Oct 10 15:15:58 PDT 2025

Total time taken to generate the page: 0.31907 seconds