uisave

Interactively save workspace variables to MAT-file

Syntax

uisave
uisave(variables)
uisave(variables,filename)

Description

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.

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

variable

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.

filename

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

Examples

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;
uisave({'h','g'},'var1');

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

Alternatives

Use any of the following GUI options to save workspace variables:

  • Use File > Save to save workspace variables.

  • Click the Save icon in the Workspace Browser.

  • Select one or more variables in the Workspace Browser, right-click, and choose Save as from the context menu.

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 the MATLAB® Figure Properties.

Tips

  • 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.

Was this topic helpful?