Open file selection dialog box and load selected file into workspace
uiopen
opens a modal
dialog box entitled Open. The file filter in the dialog box is set to all
MATLAB® files. If the user enters a valid file name in the File
Name field and clicks Open, then MATLAB opens the specified file in the
appropriate application. If the appropriate application is not installed, then
either the file opens in the MATLAB Editor
or an error is returned.
Note
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.
uiopen(
sets the file filter
according to the type of file specified (which is not the same as the file
extension). For example, if type is type
)'figure'
, then MATLAB sets the filter to all figure files
(*.fig)
.
uiopen(
specifies the file name
that appears as the default value in the dialog box File name
field. Only files that have the same file extension are displayed in the dialog box. file
)
If you specify a wildcard character and a file extension (such as
*.m
), then no file name appears in the File
name field. The dialog box displays only files with the specified
extension. The type
value appears in the filter field to the
right of the File name field.
This table lists file extensions and the application in which such a file
opens when a user selects a file with that extension and clicks
Open. If the listed tool is not installed and the file
is a text file, then the file opens in the MATLAB Editor. MATLAB returns an error if Simulink is not installed and the user selects
a file with an .mdl
or .slx
file
extension.
File Extension | Where File Loads |
---|---|
.m or .mlx | MATLAB Editor |
.fig | MATLAB Figure window. |
.mat | MATLAB workspace. |
.mlapp | MATLAB App Designer. |
.mlappinstall | MATLAB app installer |
.mdl or .slx | Simulink |
To open a file in Microsoft®
Windows®, use the winopen
function.
You can also use these functions to open a file in a MATLAB code file or in a command.