More about GUI's
What are GUI's ?
Firstly, GUI stands for Graphical User Interface. A GUI (usually pronounced GOO-ee) is a graphical (rather than purely textual) user interface to a computer. It is a program interface that takes advantage of the computer's graphics capabilities to make the program easier to use.
A graphical user interface (GUI) is a graphical display that contains devices, or components, that enable a user to perform interactive tasks. To perform these tasks, the user of the GUI does not have to create a script or type commands at the command line. Often the user does not have to know the details of the task at hand.
The GUI components can be menus, toolbars, push buttons, radio buttons, list boxes, and sliders - just to name a few. In MATLAB, a GUI can also display data in tabular form or as plots, and can group related components.
A simple example of a GUI can be the following. The various components on the GUI have also been labelled (click picture for enlarged version):
How does a GUI work?
Each component, and the GUI itself, is associated with one or more user-written routines known as callbacks. The execution of each callback is triggered by a particular user action such as a button push, mouse click, selection of a menu item, or the cursor passing over a component. You, as the creator of the GUI, provide these callbacks.
This kind of programming is often referred to as event-driven programming. The event in the example is a button click. In event-driven programming, callback execution is asynchronous, controlled by events external to the software. In the case of MATLAB GUIs, these events usually take the form of user interactions with the GUI.
Note that the writer of a callback has no control over the sequence of events that leads to its execution or, when the callback does execute, what other callbacks might be running simultaneously.
How do I go about it?
In order to design a GUI, you first need to decide what you want it to do - how you want the user to interact with it, and what components you need.
Next, you must decide what technique you want to use to create your GUI. MATLAB enables you to create GUIs programmatically or with GUIDE, an interactive GUI builder. It also provides functions that simplify the creation of standard dialog boxes. The technique you choose depends on your experience, your preferences, and the kind of GUI you want to create.
For the purpose of this lab, we will learn how to make a GUI in Matlab using GUIDE (Graphical User Interface Development Editor). Note that it is possible to make the same GUI without using GUIDE and you are more than welcome to try creating a GUI programmatically. For more information on creating a GUI programmatically, refer to this link.