idl: turn string value into variable name part2 [message #86010] |
Tue, 24 September 2013 01:10  |
zimttee.xperia
Messages: 2 Registered: September 2013
|
Junior Member |
|
|
Hi,
i'm new to IDL and have a problem, similar to that discussed here: https://groups.google.com/forum/#!topic/comp.lang.idl-pvwave /WZ2RAMWK-0o
But i could not solve my problem and the topic is very old, so i thought it's better to start a new one?!
I have arrays with 1032 columns and (usually, but the number of rows can vary, depending on my number of scans i measure) 720 rows, which I want to cut into (1032,80)-arrays and name the new arrays as "data1","data2",..."datan". I need them as seperated variables for a second procedure.
I've tried some possibilities yesterdays and searched with google, but i was not able to solve that problem. Maybe i was looking for the wrong keywords, i don't know... I also tried that "execute" they talked about in the discussion i've mentioned before. I copied the code and changed the variables name, but i couldn't make it work...
I hope someone can help me :-)
Ramona
|
|
|
Re: idl: turn string value into variable name part2 [message #86012 is a reply to message #86010] |
Tue, 24 September 2013 02:39   |
Moritz Fischer
Messages: 32 Registered: June 2013
|
Member |
|
|
Hi,
I think you are looking for "scope_varfetch". Something like this:
FOR i=0,n-1 DO (scope_varfetch('data'+strtrim(i,2),/ENTER)) =
array[*,i*80 : (i+1)*80 - 1]
But I recommend you try stacking the data in a third dimension:
array = reform( array, 1032, 80, n )
It's less error-prone, and you may be able to avoid loops.
Do it the IDL way! (http://www.idlcoyote.com/idl_way/idl_way.php)
cheers
Am 24.09.2013 10:10, schrieb zimttee.xperia@googlemail.com:
> Hi,
>
> i'm new to IDL and have a problem, similar to that discussed here:
> https://groups.google.com/forum/#!topic/comp.lang.idl-pvwave /WZ2RAMWK-0o
>
> But i could not solve my problem and the topic is very old, so i thought
it's better to start a new one?!
>
> I have arrays with 1032 columns and (usually, but the number of rows
> can vary, depending on my number of scans i measure) 720 rows, which
> I want to cut into (1032,80)-arrays and name the new arrays as
> "data1","data2",..."datan". I need them as seperated variables for a
> second procedure. I've tried some possibilities yesterdays and
> searched with google, but i was not able to solve that problem. Maybe
> i was looking for the wrong keywords, i don't know... I also tried
> that "execute" they talked about in the discussion i've mentioned
> before. I copied the code and changed the variables name, but i
> couldn't make it work...
>
> I hope someone can help me :-)
>
> Ramona
>
|
|
|
|