Documentation

This is machine translation

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

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

imputfile

Display Save Image dialog box

Syntax

[filename,ext,user_canceled] = imputfile

Description

example

[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).

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

Examples

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

    '\\home$\Documents\MATLAB\mytest.png'


ext =

  1×3 char array

    'png'


ucancel =

  logical

   0

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

Was this topic helpful?