help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: saving Octave state?


From: Mike Miller
Subject: Re: saving Octave state?
Date: Tue, 30 Nov 2010 01:45:29 -0600 (CST)
User-agent: Alpine 2.00 (DEB 1167 2008-08-23)

On Tue, 8 Jun 2010, John W. Eaton wrote:

On  8-Jun-2010, Mike Miller wrote:

| With GNU R it is possible to save the state of the program -- all objects
| and history -- in the default directory so that if R is launched later in
| that directory it will automatically return to it's past state.
|
| Is it possible to do this with Octave?
|
| It seems like a save command can save all arrays to disk in a path/file
| the user requests.  So that is part of the picture, if I have that right.
|
| The other trick is to reload the old history.  If I go with the default,
| it will save the history in ~/.octave_hist, but so will every other octave
| instance, and I often have several.  I could exit octave, then copy the
| history to the default directory, but then I wouldn't know how to load the
| history except by copying it to ~/.octave_hist, which seems like a bad
| idea.
|
| I have googled for this and I get lots of hits that aren't quite answering
| my question, so I hope someone here can help me out.  Thanks in advance.

I think all you need to do to get a local history file loaded and
saved automatically is to set the name of the history file.  You can
do that with a command line option or by using

 history_file ("local-octave-session-history");

in your ~/.octaverc file, which is processed before Octave loads the
history.

If you want to prime this local file with the global history or the
history of some other session, then just use something like

 history -r ~/.octave_hist

the first time you run Octave in the directory.


I decided to mimic the R filenames and call the data and history files .OData and .Ohistory (instead of .RData and .Rhistory). This is in my ~/.octaverc file:


history_file (".Ohistory");
if ( exist(".OData", "file") == 2 )
   load(".OData") ;
endif


So it automatically loads history and data, if they are present. I'm not sure if any aspect of the state of the previous instance of Octave would be missed when I launch Octave in the same directory if I had done this just before quitting the previous time:

save .OData

What do you think?

Mike


reply via email to

[Prev in Thread] Current Thread [Next in Thread]