
7 Saving and Running the GUI
7-10
Running a GUI
Generally, you run your GUI by executing the M-file that GUIDE generates.
This M-file contains the commands to load the GUI and provides a framework
for the component callbacks. See “GUI Files: An Overview” on page 8-5 for
more information about the M-file.
When you execute the M-file, a fully functional copy of the GUI displays on the
screen. You can run a GUI:
• “From the GUIDE Layout Editor” on page 7-10
• “From the Command Line” on page 7-10
• “From an M-file Script” on page 7-11
Note You can display an inactive copy of the GUI figure using the openfig,
open, or hgload command. These commands load FIG-files into the MATLAB
workspace. Note that the displayed GUI is not active.
From the GUIDE Layout Editor
Run your GUI from the GUIDE layout Editor by:
• Clicking the Run icon on the Layout Editor toolbar
• Selecting
Run from the Tools menu
In either case, GUIDE saves the GUI files before activating the GUI and opens
the GUI M-file in your default editor. See “Saving a GUI” on page 7-5 for
information about this process. See “GUI Files: An Overview” on page 8-5 for
more information about M-files.
From the Command Line
Run your GUI from the command line by entering the name of its M-file. For
example, if your GUI M-file is
mygui.m, type
mygui
at the command line. If the M-file does not reside on your MATLAB path or in
your current MATLAB directory, you must also specify the path.
Comentários a estes Manuais