Re: edit .sav file [message #61476] |
Fri, 18 July 2008 09:51 |
Craig Markwardt
Messages: 1869 Registered: November 1996
|
Senior Member |
|
|
Bulrush <Wasit.Weather@gmail.com> writes:
>
> I see. Thanks. I am a noviece IDL user. I have read a lot about
> the .sav file in this group. I tried the "RESTORE" routine, but seems
> like I still can not see the contents and add anything I want in it.
You can try,
CMSAVEDIR, 'filename.sav'
to get a list of the contents.
And if you want to append something to the file,
CMSAVE, new_variable, FILENAME='filename.sav', /APPEND
Note that these routines were eventually sanctioned by the makers of
IDL. I paid dearly to have them be public, so people might as well
use them if then need them.
Website,
http://cow.physics.wisc.edu/~craigm/idl/cmsave.html
Craig
--
------------------------------------------------------------ --------------
Craig B. Markwardt, Ph.D. EMAIL: craigmnet@REMOVEcow.physics.wisc.edu
Astrophysics, IDL, Finance, Derivatives | Remove "net" for better response
------------------------------------------------------------ --------------
|
|
|
Re: edit .sav file [message #61480 is a reply to message #61476] |
Fri, 18 July 2008 07:42  |
Allan Whiteford
Messages: 117 Registered: June 2006
|
Senior Member |
|
|
Bulrush wrote:
> On Jul 18, 3:43 am, Allan Whiteford
> <allan.rem...@phys.remove.strath.ac.remove.uk> wrote:
>
>> Bulrush wrote:
>>
>>> Hi all,
>>> Can I edit, and access the contents of a .sav file?
>>
>> It's unclear (to me, at least) exactly what you want to do.
>>
>> You can restore the contents of a .sav file at the IDL command line by
>> typing:
>>
>> restore,file='myfile.sav'
>>
>> and you get the contents to play with which you can later save.
>>
>> If you had a .sav file with two varibles, say a and b and you wanted to
>> increase the value of a by 1 then you would type:
>>
>> restore,file='myfile.sav'
>> a=a+1
>> save,a,b,file='myfile.sav'
>>
>> If you're looking for something with more power then see:
>>
>> http://cow.physics.wisc.edu/~craigm/idl/cmsave.html
>>
>> and if you're looking for something which does even more then see
>> David's reply.
>>
>> Thanks,
>>
>> Allan
>
>
> I see. Thanks. I am a noviece IDL user. I have read a lot about
> the .sav file in this group. I tried the "RESTORE" routine, but seems
> like I still can not see the contents and add anything I want in it.
>
> Thanks anyway!
After restoring your file, type the "help" command.
You should see something like:
IDL> restore,'myfile.sav
IDL> help
% At $MAIN$
A INT = 3
B INT = 2
Compiled Procedures:
$MAIN$
Compiled Functions:
IDL>
i.e. the variables stored in the save file should just end up in your
current scope.
Thanks,
Allan
|
|
|
Re: edit .sav file [message #61486 is a reply to message #61480] |
Fri, 18 July 2008 06:11  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Bulrush writes:
> I see. Thanks. I am a noviece IDL user. I have read a lot about
> the .sav file in this group. I tried the "RESTORE" routine, but seems
> like I still can not see the contents and add anything I want in it.
If you just want to see what is in a save file, and maybe
selectively restore variables and such, you can use
the IDL_Savefile object to do so. This object doesn't
allow you to add to the contents.
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
|
|
|
Re: edit .sav file [message #61488 is a reply to message #61486] |
Fri, 18 July 2008 05:36  |
Wasit.Weather
Messages: 62 Registered: February 2008
|
Member |
|
|
On Jul 18, 3:43 am, Allan Whiteford
<allan.rem...@phys.remove.strath.ac.remove.uk> wrote:
> Bulrush wrote:
>> Hi all,
>> Can I edit, and access the contents of a .sav file?
>
> It's unclear (to me, at least) exactly what you want to do.
>
> You can restore the contents of a .sav file at the IDL command line by
> typing:
>
> restore,file='myfile.sav'
>
> and you get the contents to play with which you can later save.
>
> If you had a .sav file with two varibles, say a and b and you wanted to
> increase the value of a by 1 then you would type:
>
> restore,file='myfile.sav'
> a=a+1
> save,a,b,file='myfile.sav'
>
> If you're looking for something with more power then see:
>
> http://cow.physics.wisc.edu/~craigm/idl/cmsave.html
>
> and if you're looking for something which does even more then see
> David's reply.
>
> Thanks,
>
> Allan
I see. Thanks. I am a noviece IDL user. I have read a lot about
the .sav file in this group. I tried the "RESTORE" routine, but seems
like I still can not see the contents and add anything I want in it.
Thanks anyway!
|
|
|
Re: edit .sav file [message #61490 is a reply to message #61488] |
Fri, 18 July 2008 01:43  |
Allan Whiteford
Messages: 117 Registered: June 2006
|
Senior Member |
|
|
Bulrush wrote:
> Hi all,
> Can I edit, and access the contents of a .sav file?
It's unclear (to me, at least) exactly what you want to do.
You can restore the contents of a .sav file at the IDL command line by
typing:
restore,file='myfile.sav'
and you get the contents to play with which you can later save.
If you had a .sav file with two varibles, say a and b and you wanted to
increase the value of a by 1 then you would type:
restore,file='myfile.sav'
a=a+1
save,a,b,file='myfile.sav'
If you're looking for something with more power then see:
http://cow.physics.wisc.edu/~craigm/idl/cmsave.html
and if you're looking for something which does even more then see
David's reply.
Thanks,
Allan
|
|
|
Re: edit .sav file [message #61494 is a reply to message #61490] |
Thu, 17 July 2008 19:45  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Bulrush writes:
> Can I edit, and access the contents of a .sav file?
No, and don't even try. We don't need *that* police scene
again. :-(
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
|
|
|