Referencing various variables through string( )? [message #47803] |
Tue, 07 March 2006 08:49 |
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.
|
|
|