You won’t like to loose the variables and the command history generated after hours or days of work in octave. It is a good idea to save the environment in intervals to create backup points in addition to save from crashes. Here’s a quick tutorial on how to save your working environment in octave.

It’s simple. Just execute the below lines.

save ('my_environment');
history -w 'my_history';

The first one saves all the variables in the environment into the file named “my_environment” . help save tells “If no variable names are listed, Octave saves all the variables in the current scope.” . The history command with the -w tag saves the command history to the “my_history” file. If you do not specify a file name, then it will save the history into the “~/.octave_hist” file by default.

To restore the environment once you restart octave, you need to do the following.

load ('my_environment');
history -r 'my_history';

Just loads and restores all the variables from “my_environment” and reads the command history, with the -r switch, from “my_history” file.

Checkout the help pages of save, load, history for details.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s