Open dialog box for saving variables to MAT-file




uisave, with no arguments, prompts you for a file name, and then saves all variables from your workspace to that file.

uisave(variables) saves one or more workspace variables listed in variables. The variables argument is a string or a cell array of strings.

uisave(variables,filename) uses the specified filename as the default File name in the Save Workspace Variables dialog box, instead of the default matlab.mat.

Input Arguments


String containing the name of a variable in the current workspace or cell array of strings when specifying more than one variable.

Default: All variables in the current workspace are saved to a MAT-file.


String naming a file to appear in the dialog File name field when the dialog opens. You can omit a file extension, or specify the file extension as .mat.

Default: matlab.mat


Create workspace variables h and g, and then display the Save Workspace Variables dialog box in the current folder with the default File name set to var1.

h = 365;
g = 52;

Clicking Save stores the workspace variables h and g in the file var1.mat in the displayed folder.

More About

expand all

Modal Dialog

A modal dialog box prevents the user from interacting with other windows before responding. For more information, see WindowStyle in Figure Properties.


  • If you type a name in the File name field, such as my_vars, and click Save, the dialog saves all workspace variables to the file my_vars.mat. The default filename is matlab.mat.

  • uisave calls uiputfile to choose a filename.

  • If the filename you specify exists in that folder, uisave informs you and gives you a chance to cancel the operation.

  • The uisave dialog box is modal.

  • The uisave dialog is modal. A modal dialog box prevents you from interacting with other windows until you respond to it.

Introduced before R2006a

Was this topic helpful?