This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.


Open dialog box for saving variables to MAT-file




uisave opens a modal Save Workspace Variables dialog box. If the user clicks Save, then MATLAB® saves all variables from the user's workspace to the file displaying in the dialog box File name field.

If the named file already exists in the folder displayed at the top of the dialog box, then a confirmation dialog box opens and gives the user an opportunity to cancel the operation or overwrite the existing file.

uisave(vars) specifies which variables from the user's workspace to save.


uisave(vars,file) specifies the file name that appears in the File name field of the Save Workspace Variables dialog box when it opens, instead of the default, matlab.mat.


collapse all

Create three workspace variables, d, w, and y. Then, open a Save Workspace Variables dialog box with a default file, var1.mat, displaying in the File name field.

d = 'Sunday';
w = 31;
y = 2017;

Click Save to save the workspace variables d and w to var1.mat in the folder that is displayed at the top of the dialog box.

Input Arguments

collapse all

Set of workspace variables to save in a MAT-file, specified as a character vector, cell array of character vectors, or a string array. To specify more than one variable, use a cell array of character vectors.

Example: 'y'

Example: {x','y'}

File name that displays in the File name field when the Save Workspace Variables dialog box opens. You can omit a file extension or specify the file extension as .mat.

Example: 'data1'

Example: 'data1.mat'

Example: 'v'

More About

collapse all

Modal Dialog Box

A modal dialog box prevents the user from interacting with other MATLAB windows before responding.

Introduced before R2006a