uiputfile

Purpose

Retrieve name of a file to write to through a dialog box.

Synopsis

[filename,pathname] = uiputfile('initFile','boxTitle',x,y)

Description

[filename,pathname] = uiputfile('initFile','boxTitle',x,y) displays a dialog box in which you can fill in or select the filename and path strings, where

  • initFile determines the initial display of files in the dialog box. This string can be a full filename, or it may include wildcards. For example, 'newfile.m' initializes the text box to that filename, providing a default. A wildcard specification such as '*.m' does not provide a default, but the scroll box lists all files with the ".m" extension.
  • boxTitle is a string containing the title of the dialog box.
  • x is the x-position, in pixels, of the lower-left corner of the dialog box (not supported on all systems).
  • y is the y-position, in pixels, of the lower-left corner of the dialog box (not supported on all systems).
    All parameters are optional, but if one is present, all preceding parameters must also be present. If you select a file that exists, a prompt is issued asking whether you want to delete the file. A Yes response successfully returns but does not delete the file (which is the responsibility of the calling routines). A No response returns control back to the dialog box. You can then enter another filename or press the Cancel button.

    filename is a string containing the name of the file selected in the dialog box. If you press the Cancel button or if any error occurs, filename is set to 0.

    pathname is a string containing the path of the file selected in the dialog box. If you press the Cancel button or if any error occurs, pathname is set to 0.

    Examples

    An example of uiputfile's operation on one platform is

    [fname,pname] = uiputfile('animinit.m','Example Dialog 
    Box')
              
    

    fname = animinit.m pname = /amnt/u/home2/pat

    The exact appearance of the dialog box depends on your windowing system.

    See Also

    uigetfile
    

    (c) Copyright 1994 by The MathWorks, Inc.