A Simple GUI with One User Interaction

Creating a layout

1. To get started, select the guide icon from the toolbar, or type guide at the command line.


2. The GUIDE Quick Start window will open.

3. To start a new project, simply select the Blank GUI template, located in the list on the left-hand side of the window.
4. After that a new figure window—called the GUIDE layout editor—will open.

5. To create a layout of buttons, textboxes, and graphics windows, use the icons on the left-hand side of the window in the “component palette.”                                                                                                                                                                 6. To change the palette of tools to a list of the item names select File ➞ Preferences ➞ GUIDE then check “Show names in component palette.”

7. The Property Inspector is used to modify the design elements.
8. The Property Inspector can be accessed from the menu bar by selecting View ➞ Property Inspector
9. The Property Inspector lists a wide range of properties for the selected object in the GUIDE window.
10. One can change the font of the message displayed, change the color of the text box etc.
11. Use the same process to modify the properties of the “edit text” box.
12. The GUIDE window can be saved and run by selecting the Save and Run icon from the window toolbar.

Adding Code to M-File

1. The m-file is organized as a function, with multiple sub-functions.
2. Some of the subfunctions create the graphics in the saved window.
3. Others are reserved for adding the code that will cause an action when a user interacts with the GUI.
4. To see a list of the functions in the saved file, select the Show Functions icon on the toolbar.
5. The only functions a user should modify are labeled as:


1. It allows the user to interact with the GUI.
2. Clicking on the function of interest will shows the corresponding section of code.
3. An alternative approach to find the appropriate sub-function to modify is to use the layout editor.
4. Right click on the graphics object, select View Callbacks, then select Callback.

get Function

1. When a user types in a textbox, the contents are stored as the string property.
2. To retrieve the information and use it in m-file, use the get function.


1. To run GUI, select the Save and Run icon from the m-file window or from the Guide layout editor.
2. To run the GUI, type a value into the edit window, and hit enter.
3. The opening function is the only other sub-function to be modified in this file.
4. It executes when the GUI first runs, and can be used to control how the figure window appears before the user starts adding data.