Saving your Matlab sessions

March 26th, 2010 Posted in Examples

Often one wants to save the data or variables to another occasion. Maybe one wants to save the whole . This can be done. Commands are put in a but data or variables are stored in a mat-file (binary file) which can be opened with . First have a look in the workspace to find out how your varables look like. Then save these in a mat-file.

1
2
3
save execution1 % variables will now saved in a mat-file execution1.mat
clear % clears all variables from the present Workspace.
load execution1 % restores all variables stored in the execution1.mat

We can also store everything that is displayed in the . Like the whole session both the command lines and the output from Matlab, id est the calculations. This can be done by:

1
diary exercise % stores the whole session in file exercise(ascii-file)

Everything that follows from now on in the command window will be stored in the -file exercise. Write just anything to get some response from Matlab into the command window. off % turns of the storage of the session to the file exercise9. Find the file exercise and see if the content in the file is the same that were displayed in the command window!

Leave a Reply

You must be logged in to post a comment.