This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.


Display Save Image dialog box


[filename,ext,user_canceled] = imputfile



[filename,ext,user_canceled] = imputfile displays the Save Image dialog box which you can use to specify the full path and format of a file. Using the dialog box, you can navigate to folders in a file system and select a particular file or specify the name of a new file. imputfile limits the types of files displayed in the dialog box to the image file format selected in the Files of Type menu.

When you click Save, imputfile returns the full path to the file in filename and the file extension associated with the file format selected from the Files of Type menu in ext. imputfile automatically adds the file name extension (such as .jpg) to the file name.

If the user clicks Cancel or closes the Save Image dialog box, imputfile closes and returns control to MATLAB®, setting user_canceled to True (1), and settingfilename and ext to empty character vectors (''); otherwise, user_canceled is False (0).


The Save Image dialog box is modal; it blocks the MATLAB command line until you click Save or cancel the operation.


collapse all

Open the Save Image dialog box. This dialog box is modal—control in the command window is suspended until you respond to the Save Image dialog box.

[fn, ext, ucancel] = imputfile

To view only images in Portable Network Graphics format, select the format from the Save as type menu.

Specify a new filename and click Save. imputfile returns the full path of the filename you specified, the file extension, and the Boolean value false, meaning that you didn’t click Cancel. Note that imputfile automatically adds the file extension of the format you selected to the file name.

fn =

  1×37 char array


ext =

  1×3 char array


ucancel =



Output Arguments

collapse all

Name of file selected, returned as a character array.

File extension of a supported file format, returned as a character array.

Flag indicating if user chose to cancel dialog, returned as a Boolean logical value true or false.

Introduced in R2007b