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

Home » Public Forums » archive » Referencing various variables through string( )?
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Referencing various variables through string( )? [message #47803] Tue, 07 March 2006 08:49
Daelomin is currently offline  Daelomin
Messages: 7
Registered: March 2006
Junior Member
Hi again,

I promise I wont be spamming the list, but because I have so many
variables to deal with (say, arrays tcwv1,..tcwv7,tb1,...tb7 and many
others), I was hoping you guys would have a dirty trick to reference an
array by a concatenation of strings ?

If I am being obscure, I'd like to do this: (which doesnt work)

for k = 1, NPoints do begin
for i = 1, 200641 do begin

array ="tcwv"+string(i)
tmp=array[k] ;; which would be evaled to tcwv1[k] obviously

endfor
endfor

It probably is very bad programming hehe but right now the copy/paste
of names is killing me

The reason why I didnt store values in a bigger array
(tcwv=fltarr(7,NPoints) for example) is that when I assign a column to
a variable, I always get a variable of size (1,Npoints) instead of
Npoints... There must be a function to drop the "useless" reference to
a 1D array in 2 variables, I just dont know it...

Sorry for the newbiness of it all.
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Interpolating a regular grid
Next Topic: Re: Referencing various variables through string( )?

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

Current Time: Wed Oct 08 17:43:32 PDT 2025

Total time taken to generate the page: 0.00532 seconds