This is machine translation

Translated by Microsoft
Mouse over text to see original. Click the button below to return to the English verison of the page.


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 character vector or a cell array of character vectors.

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


Character vector or cell array of character vectors containing one or more variable names in the current workspace. Use a cell array of character vectors to specify more than one variable.

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


Character vector that specifies the file name that appears in the File name field when the dialog box 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

collapse 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?