MATLAB Functions Help Desk

uiputfile

Purpose

Interactively select a file for writing

Syntax

Description

uiputfile displays a dialog box used to select a file for writing. The dialog lists the directories in your current directory. The default position of the dialog box is the upper-left corner of your monitor.

uiputfile('filterSpec') displays a dialog box that lists the files in the current directory specified by 'filterSpec' . 'filterSpec' is a full filename or includes wildcards. A wildcard specification such as '*.m' does not provide a default file and the scroll box lists only files with the .m extension.

uiputfile('filterSpec','dialogTitle') displays a dialog box that has the title 'dialogTitle'.

uiputfile('filterSpec','dialogTitle',x) positions the upper-left corner of the dialog box at (x,0), where x is in pixel units. Note that positioning may not work on all platforms.

uiputfile('filterSpec','dialogTitle',x,y) positions the upper-left corner of the dialog box. x and y are the x- and y-position, in pixels, of the dialog box. Note that positioning may not work on all platforms.

[fname,pname] = uiputfile(...) returns the filename and pathname (or folder) selected in the dialog box. After you press the Done button, fname contains the name of the file selected and pname contains the name of the path selected. If you press the Cancel button or if 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 select OK, the function successfully returns but does not delete the existing file (which is the responsibility of the calling routines). If you select Cancel, the function returns control back to the dialog box so that you can enter another filename.

Examples

Display a dialog box titled 'Example Dialog Box' (the exact appearance of the dialog box depends on your windowing system):

See Also

uigetfile



[ Previous | Help Desk | Next ]