|
|
|
|
|
Saving and Loading
How to Examples How to: If you need to shut down MATLAB, in order to start it up another time, without losing all the work you've already done, you can use MATLAB's save command to copy the current values of all your variables into a file on your hard-drive. Just type: save YourFileNameHere This creates a file in the current MATLAB directory called YourFileNameHere.mat which stores all your variables and their values. If you just type save, without specifying a filename, MATLAB saves your variables in a default file named matlab.mat. Note: the save command DOES NOT STORE an account of the commands you have entered (which you might want/need if working on a homework assignment). In order to keep track of your steps, please see the diary command, detailed in the next section. In order to retrieve the variables you have saved to your hard-drive just type: load YourFileNameHere Or you can just type load if you saved your work in the default matlab.mat file. Examples: Not too much to demonstrate in this section. Let's save all our variables to a file called "LinearAlgebraHomework1": save LinearAlgebraHomework1 Now, let's load that file back: load LinearAlgebraHomework1 |