Creating Graphical User Interfaces    

Creating GUIs with GUIDE

MATLAB implements GUIs as figure windows containing various uicontrol objects. You must program each object to perform the action you intend it to do when a user activates the component. In addition, you must be able to save and run your GUI. All of these tasks are simplified by GUIDE, the MATLAB graphical user interface development environment.

This section covers the following topics:

GUI Development Environment

Creating a GUI involves two basic tasks:

For an example of these tasks, see Example: Creating a GUI.

GUIDE primarily is a set of layout tools. However, GUIDE also generates an M-file that contains code to handle the initialization and launching of the GUI. This M-file provides a framework for the implementation of the callbacks -- the functions that execute when users activate components in the GUI.

GUIDE Generated Files

While it is possible to write an M-file that contains all the commands to lay out a GUI, it is much easier to use GUIDE to lay out the components interactively. When you save or run the GUI, GUIDE automatically generates two files:

Note that the M-file does not contain the code that lays out the uicontrols; this information is saved in the FIG-file.

Features of the GUI M-file

GUIDE simplifies the process of creating GUIs by automatically generating the GUI M-file directly from your layout. GUIDE generates callbacks for each component in the GUI that requires a callback. Initially, GUIDE generates just a function definition line for each callback. You can add code to the callback to make it perform the operation you want.

The M-file contains two other functions where you might also need to add code:

See Understanding the GUI M-File for more details.

  What Is a GUI? Editing Version 5 GUIs with Version 6 GUIDE