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. Please click here
To view all translated materials including this page, select Japan from the country navigator on the bottom of this page.


Open dialog box for selecting files to load into workspace


uiopen(filename, TF)


uiopen displays the dialog box with the file filter set to all MATLAB® files (with file extensions *.m, *.mlx, *.mat, *.fig, *.mdl, and *.slx).

uiopen(type) sets the file filter according to the type.

uiopen(filename) displays filename as the default value for File name in the dialog box and lists only files having the same extension.

uiopen(filename, TF) directly opens file filename without displaying a dialog box if TF is true, and displays the dialog box if TF is false.


The visual characteristics of the dialog box depend on the operating system that runs your code. For instance, some operating systems do not show title bars on dialog boxes.

Input Arguments


Character vector that specifies the kind of file to show in the dialog box (the file filter). Acceptable values for type are the following.

Type ValueFiles Displayed
'matlab'All MATLAB files (with file extensions *.m, *.mlx, *.mat, *.fig, *.mdl, and *.slx.)
'load'All MAT-files (*.mat)
'figure' All figure files (*.fig)
'simulink'All Simulink® model files (*.mdl and *.slx)
'editor'All MATLAB files except for .mat, .fig, and .slx files.


The name of the file to open, specified as a character vector that includes the file extension. The filename can be a wildcard character plus extension. For example, *.txt displays a list of all files with the file extension .txt.


A MATLAB expression that evaluates to true or false. If true, filename opens directly, without displaying the dialog.


Filter to display only FIG-files by setting the Files of type field to Figures (*.fig):


More About

collapse all

Modal Dialog

A modal dialog box prevents the user from interacting with other windows before responding. For more information, see WindowStyle in the MATLAB Figure Properties.


When you select a file and click open, uiopen does the following:

  • Gets the file using uigetfile.

  • Opens the file using the open command.

    • Files with a file extension of .m and .mlx open in the Editor.

    • Variables stored in files with a file extension of .mat appear in the caller's workspace.

    • Files with a file extension of .fig open as figure windows.

    • Files with a file extension of .mdl or .slx open as models in Simulink.

  • uiopen('load') is the only the form of uiopen that you can compile into a standalone application. You can create a file selection dialog box that you can compile using uigetfile.

  • The uiopen dialog box is modal. A modal dialog box prevents you from interacting with other windows until you respond to the modal one.

  • uiopen displays the same dialog box that opens when you use the MATLAB desktop toolstrip to open a file. (On the Home tab, in the File section, click Open .)


In MATLAB code or in a command:

  • To open a file appropriately based on its file extension, use the open function.

  • To open a file in the Editor, use the edit function.

  • To open a MAT-file and load its contents into the workspace, use the load function.

  • To open a FIG-file, use the openfig function.

  • To open a file in an application in Microsoft® Windows®, use the winopen function.

Introduced before R2006a

Was this topic helpful?