uiputfile
Open dialog box for saving files
Syntax
Description
file = uiputfile
- If the user specifies a valid file name and clicks Save, then MATLAB® returns that file name in - file.
- If the user cancels the dialog box, then MATLAB returns - 0to- file.
Note
- Successful execution of - uiputfilereturns the name of a new or existing file that the user specifies. It does not create a file.
- The visual characteristics of the dialog box depend on the operating system that runs your code. For instance, some operating systems do not show title bars on dialog boxes. If you pass a dialog box title to the - uiputfilefunction, those operating systems do not display the title.
___ = uiputfile(
                displays only those files with extensions that match filter)filter. On
                some platforms uiputfile also displays any files that do not
                match filter, but they are dimmed. The
                    uiputfile function appends All Files
                to the list of file types. 
If filter is a file name, then uiputfile
                displays the file name in the File name field and uses the file
                extension as the default filter. 
Use this syntax with any of the output argument combinations in the previous syntaxes.
Examples
Input Arguments
Output Arguments
More About
Tips
- To write data to a user-specified file and location using MATLAB and MATLAB toolbox functions, use the path and file name that - uiputfilereturns. For example:- fprintffor writing data to a text file.
- imwritefor writing an image to a graphics file.
- xlswritefor writing a matrix to a Microsoft® Excel® spreadsheet. For example, this code creates a matrix,- A, creates a dialog box to get a file name from the user, builds a full file name from the returned values, and then writes the matrix to the user-specified Excel file.- A = [12.7 5.02 -98 63.9 0 -.2 56]; [file,location] = uiputfile('*.xlsx'); filename = fullfile(location,file); xlswrite(filename,A);
 
Version History
Introduced before R2006a






