The MATLAB workspace contains variables that you create or import into MATLAB from data files or other programs. You can view and edit the contents of the workspace in the Workspace browser or in the Command Window. To modify the contents of variables, use the Variables editor.
Workspace variables do not persist after you exit MATLAB.
To use your data across multiple MATLAB sessions, save it to
a compressed file with a
.mat extension called
a MAT-file. You can restore saved data by loading a MAT-file back
||Remove items from workspace, freeing up system memory|
||Clear variables from memory|
||Display value of variable|
||Open workspace variable in Variables editor or other graphical editing tool|
||List variables in workspace|
||List variables in workspace, with sizes and types|
Create, edit, and copy variables in the MATLAB workspace, in the Command Window or using the Workspace browser and Variables editor.
Save some or all variables in the current workspace and reload the variables later during the current MATLAB session, or during another session.
Set preferences for the Workspace browser and Variables editor.
MAT-files are binary MATLAB files that store workspace variables.
If you define a function that loads data from a MAT-file, and find that MATLAB does not return the expected results, check whether any variables in the MAT-file share the same name as a MATLAB function.