Display Save Image dialog box
[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.
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,
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
adds the file name extension (such as
the file name.
If the user clicks Cancel or closes the Save
Image dialog box,
imputfile closes and
returns control to MATLAB®, setting
empty character vectors (
Note: The Save Image dialog box is modal; it blocks the MATLAB command line until you click Save or cancel the operation.
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
meaning that you didn't click Cancel.
imputfile automatically adds the file
extension of the format you selected to the file name.
fn = 1×37 char array '\\home$\Documents\MATLAB\mytest.png' ext = 1×3 char array 'png' ucancel = logical 0
filename— Name of file selected
Name of file selected, returned as a character array.
ext— File extension of a supported file format
File extension of a supported file format, returned as a character array.
user_canceled— Flag indicating if user chose to cancel dialog
Flag indicating if user chose to cancel dialog, returned as