Creating Graphical User Interfaces | ![]() ![]() |
MATLAB includes a set of layout tools that simplify the process of creating graphical user interfaces (GUIs). These tools include:
Access these tools from the Layout Editor. To start the Layout Editor, use the guide
command. For example,
guide
To load an existing GUI for editing, type (the .fig
is not required)
guide mygui
.fig
or use Open... from the File menu on the Layout Editor.
Saving Your Layout
Once you have created the GUI layout, you can save it as a FIG-file (a binary file that saves the contents of a figure) using the Save or Save As item from the File menu. GUIDE creates the application M-file automatically when you save or activate the figure.
Displaying Your GUI
You can display the GUI figure using the openfig
, open
, or hgload
command. These commands load FIG-files into the MATLAB workspace.
Generally, however, you launch your GUI by executing the application M-file that is generated by GUIDE. This M-file contains the commands to load the GUI and provides a framework for the component callbacks. See Configuring Application Options for more information.
![]() | Changing the Name of the M-file and FIG-file | Laying Out GUIs - The Layout Editor | ![]() |