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

Home » Public Forums » archive » Declaring large vectors in IDL
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: Declaring large vectors in IDL [message #70539 is a reply to message #70493] Tue, 20 April 2010 14:46 Go to previous messageGo to previous message
fgg is currently offline  fgg
Messages: 67
Registered: April 2010
Member
> If you want to preserve the variable names in your file, then once you
> have an array of variable names from your gettok call, you use
> EXECUTE:
>
> for i=0,n_data-1 do dummy = execute(variable_names[i]+'=
> double(strsplit(data[i],",",/extract)')
>
> where you can replace "double" with whatever type conversion function
> you like.

Hey Gray,

I included 'execute' in the code but it didn't help. When I run the
procedure the variables are not added to the variables view. For
instance, if you run this procedure:

pro test
heads=['a', 'b', 'c']
data = ['1 2 3', '4 5 6', '7 8 9']
for i=0,2 do dummy = execute(heads[i]+'=double(strsplit(data[i],",",/
extract))')
end

"a", "b", and "c" will not be added to the variables view (with values
'1 2 3', '4 5 6', and '7 8 9', respectively). Is that what you
suggested? I replaced the 4th line with:

for i=0,2 do dummy = execute(heads[i]+'= ['+strjoin(strsplit(data[i],/
extract),', ')+']')

...and it didn't work either.

------------------------------------------

pp, you are right. The procedure declaration is missing here but it is
actually included in the original *.pro file. Your suggestion worked.
If I compile this procedure:

pro test, a, b, c
heads=['a', 'b', 'c']
data = ['1 2 3', '4 5 6', '7 8 9']
for i=0,2 do dummy = execute(heads[i]+'= ['+strjoin(strsplit(data[i],/
extract),', ')+']')
end

... and then enter "test, a, b, c" at the IDL prompt, "a", "b", and
"c" are added to the variables view with the respective values. The
only problem is that I'm actually dealing with many different
variables. Is it possible to call "test", getting the variables name
from "heads" (the variable containing the names) instead of typing
each name? (i.e. a, b, c...). If so, I guess the first line of the
procedure would need to be changed as well, right?

Thanks you all for the help!
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Problem with variable declaration
Next Topic: Rounding off

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

Current Time: Sat Oct 11 17:48:04 PDT 2025

Total time taken to generate the page: 2.72078 seconds