Saving your Matlab sessions
Often one wants to save the data or variables to another occasion. Maybe one wants to save the whole Matlab session. This can be done. Commands are put in a m-file but data or variables are stored in a mat-file (binary file) which can be opened with Workspace Browser. First have a look in the workspace to find out how your varables look like. Then save these in a mat-file.
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 command window. Like the whole session both the command lines and the output from Matlab, id est the calculations. This can be done by:
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 ascii-file exercise. Write just anything to get some response from Matlab into the command window. diary 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!