Environment/Workspace



An Matlab environment or workspace is the collection of variables and functions that have been initialized in a command session.

To view the variables in the current environment use the who command. whos returns the variables in use and their size.

To remove a specific variable in the current session use the command

>>clear variable

To remove all variables in the current session use the command

>>clear

One can save the current Matlab environment variables by selecting the File/Save Workspace as menu item in the GUI, or by using the save command. The default file name for a data image is matlab.mat.

To load a workspace, one can select the File/Load Workspace menu item in the GUI or by using the load command.

Samples

  who            % examine the variables in the session
  Your variables are:
   x         y         
  
  clear x        % remove the variable x from the workspace
  who            % examine the new set of variables

  Your variables are:
  y         


UCLA Mathematics Department ©2000