MATLAB Function Reference    
uiputfile

Interactively select a file for writing

Syntax

Description

uiputfile displays a dialog box used to select a file for writing. The dialog box lists the files and directories in the current directory.

uiputfile('InitFile') displays a dialog box that contains a list of files in the current directory determined by InitFile. InitFile is a full filename or includes the * wildcard. For example, specifying '*.m' (the default) causes the dialog box list to show only MATLAB M-files.

uiputfile('InitFile','DialogTitle') displays a dialog box that has the title DialogTitle.

uiputfile('InitFile','DialogTitle',x,y) positions the dialog box at screen position [x,y], where x and y are the distance in pixel units from the left and top edges of the screen. Note that positioning may not work on all platforms.

[fname,pname] = uiputfile(...) returns the name and path of the file selected in the dialog box. If you press the Cancel button or an error occurs, fname and pname are set to 0.

Remarks

If you select a file that already exists, a prompt asks whether you want to overwrite the file. If you choose to, the function successfully returns but does not delete the existing file (which is the responsibility of the calling routines). If you select Cancel in response to the prompt, the function returns control back to the dialog box so you can enter another filename.

Examples

This statement displays a dialog box titled 'Save file name' (the exact appearance of the dialog box depends on your windowing system) with the filename animinit.m.

See Also

uigetfile


 uint8, uint16, uint32 uiresume, uiwait