Documentation Center

  • Trial Software
  • Product Updates

uiopen

Interactively select file to open and load data

Syntax

uiopen
uiopen(type)
uiopen(filename)
uiopen(filename, TF)

Description

uiopen displays the dialog box with the file filter set to all MATLAB® files (with file extensions *.m, *.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.

Input Arguments

type

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

Type stringFiles Displayed
matlabAll MATLAB files (with file extensions *.m, *.mat, *.fig, *.mdl, and *.slx.)
loadAll MAT-files (*.mat)
figure All figure files (*.fig)
simulinkAll Simulink® model files (*.mdl and *.slx)
editorAll MATLAB files except for .mat, .fig, and .slx files.

filename

A string, including the file extension, naming a file to open. The filename can be a wildcard character plus extension. For example, *.txt displays a list of all files with the file extension .txt.

TF

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

Examples

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

uiopen('figure')

Alternatives

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.

More About

expand 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.

Tips

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

See Also

| |

Was this topic helpful?