Display Save Image dialog box
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.
If you click Save, then
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
imputfile automatically adds the file name
extension (such as
.jpg) to the file name.
If you click Cancel or close the Save Image dialog
imputfile closes and returns control to MATLAB®, sets
True (1), and
ext to empty character vectors
The Save Image dialog box is modal; it blocks the MATLAB command line until you click Save or cancel the operation.
Get User-Specified File Name
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 file name and click Save.
imputfile returns the full path of the file name you specified,
the file extension, and the Boolean value
false, meaning that you did
not click Cancel. Note that
automatically adds the file extension of the format you selected to the file
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
Introduced in R2007b