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

Home » Public Forums » archive » Dynamically naming structures 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: Dynamically naming structures in IDL [message #91559 is a reply to message #91557] Wed, 29 July 2015 13:45 Go to previous messageGo to previous message
wlandsman is currently offline  wlandsman
Messages: 743
Registered: June 2000
Senior Member
What if you also put the SAVE statement in execute()

status = execute("save, newname, file = '/Users/me/Documents/omni_general_'+year+'.sav' ")

On Wednesday, July 29, 2015 at 3:12:17 PM UTC-4, Scheherazade wrote:
> On Wednesday, July 29, 2015 at 2:23:10 PM UTC-4, wlandsman wrote:
>> If I understand correctly, you could use EXECUTE() to rename your structure:
>>
>> newname = 'new_structure_' + year
>> status = execute( newname + '= TEMPORARY(new_variables)' )
>> save, newname, filename = '/Users/me/Documents/omni_general_'+year+'.sav'
>>
>>
>> On Wednesday, July 29, 2015 at 1:08:52 PM UTC-4, Scheherazade wrote:
>>> I have a structure, 'omni_gen', which is filled with data for 2011, 2012, and 2013. In my program, I pull data out based on year (which is input) using a where statement, create variables for the selected data, and run these variables through a routine which outputs a new set of variables. I want to save these new variables to a structure, so I can later concatenate them together to plot.
>>>
>>> I first save my structure to a different filename each time:
>>>
>>> year=strcompress(string(year), /remove_all)
>>>
>>> new_variables=create_struct('new_globtec_'+year, new_globtec, 'new_day_'+year, new_day_numb, 'new_f10_'+year, new_f10_data, $
>>> 'new_ap_'+year, new_ap_data, 'new_smf10_'+year, new_smf10)
>>>
>>> save, new_variables, filename='/Users/me/Documents/omni_general_'+year+'.sav'
>>>
>>> When I go to concatenate the structures, I restore these files and manually rename the corresponding new_variables structure each time, like so:
>>>
>>> restore, '/Users/keleuterio/Documents/omni_2011.sav'
>>> new_variables=omni_data_2011
>>>
>>> But this obviously isn't automated. Is there a different way to do this so that the structure itself will have a different name each time (ex: new_structure_2011, new_structure_2012)?
>
> That successfully renamed the structure while in the program, but it doesn't work when I restore the file later (since it saves newname, not the new structure).
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Skip file during loop based on subprocess
Next Topic: Which "PATH" did IDL use???

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

Current Time: Wed Oct 08 16:02:35 PDT 2025

Total time taken to generate the page: 0.00195 seconds