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

Home » Public Forums » archive » name a variable with number
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: name a variable with number [message #87454 is a reply to message #87453] Tue, 04 February 2014 05:57 Go to previous messageGo to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
rjp23@le.ac.uk writes:

> This is probably a "bad" way of doing it but I often use "execute" to generate variable names dynamically based on the contents of other variables which I think sounds like what you want to do.
>
> For example:
>
> for j=0, 24 do blah=execute('n'+strtrim(j,2)+'=nn[*,j]')
>
> This will create the 25 arrays named n0, n1, n2, etc that contain nn[0,*], etc.
>
> I'd be interested in what David et al. this of this as I end up using it quite often (but in more complicated situations).

I think in the hands of someone who knows what they are doing this can
be a powerful programming technique. I rarely see it used in those kind
of hands. :-)

Cheers,

David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thue. ("Perhaps thou speakest truth.")
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: accessing IDL internal (aka "built-in") routines
Next Topic: Error using data structures while reading ASCII file with different data types

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

Current Time: Fri Oct 10 06:17:48 PDT 2025

Total time taken to generate the page: 1.43681 seconds