Open a New GUI in the GUIDE Layout Editor
Start GUIDE by typing guide at the MATLAB prompt.
In the GUIDE Quick Start dialog box, select the Blank GUI (Default) template, and then click OK.
Display the names of the GUI components in the component palette:
Select File > Preferences > GUIDE.
Select Show names in component palette.
Set the GUI Figure Size in GUIDE
Set the size of the GUI by resizing the grid area in the Layout Editor. Click the lower-right corner and drag it until the GUI is approximately 3 in. high and 4 in. wide. If necessary, make the window larger.
Add Components to the Simple GUIDE GUI
Add the three push buttons to the GUI. Select the push button tool from the component palette at the left side of the Layout Editor and drag it into the layout area. Create three buttons, positioning them approximately as shown in the following figure.
Add the remaining components to the GUI.
A static text area
A pop-up menu
Arrange the components as shown in the following figure. Resize the axes component to approximately 2-by-2 inches.
Align the Components
If several components have the same parent, you can use the Alignment Tool to align them to one another. To align the three push buttons:
Select all three push buttons by pressing Ctrl and clicking them.
Select Tools > Align Objects.
Make these settings in the Alignment Tool:
Left-aligned in the horizontal direction.
20 pixels spacing between push buttons in the vertical direction.
Add Text to the Components
The push buttons, pop-up menu, and static text have default labels when you create them. Their text is generic, for example Push Button 1. Change the text to explain what the component is for in your GUI.
Label the Push Buttons
List Pop-Up Menu Items
Modify the Static Text
After you change the text as described in this section, the GUI looks like this in the Layout Editor.
Label the Push Buttons. Each of the three push buttons specifies a plot type: surf, mesh, and contour. This topic shows you how to label the buttons with those options.
Select View > Property Inspector.
In the layout area, click the top push button.
In the Property Inspector, select the String property, and then replace the existing value with the word Surf.
Click outside the String field. The push button label changes to Surf.
Click each of the remaining push buttons in turn and repeat steps 3 and 4. Label the middle push button Mesh, and the bottom button Contour.
List Pop-Up Menu Items. The pop-up menu provides a choice of three data sets: peaks, membrane, and sinc. These data sets correspond to MATLAB functions of the same name. This topic shows you how to list those data sets as choices in the pop-menu.
In the layout area, click the pop-up menu.
In the Property Inspector, click the button next to String. The String dialog box displays.
Replace the existing text with the names of the three data sets: Peaks, Membrane, and Sinc. Press Enter to move to the next line.
When you finish editing the items, click OK.
The first item in your list, Peaks, appears in the pop-up menu in the layout area.
Modify the Static Text. In this GUI, the static text serves as a label for the pop-up menu. This topic shows you how to change the static text to read Select Data.
In the layout area, click the static text.
In the Property Inspector, click the button next to String. In the String dialog box that displays, replace the existing text with the phrase Select Data.
The phrase Select Data appears in the static text component above the pop-up menu.
Completed Simple GUIDE GUI Layout
In the Layout Editor, your GUI now looks like this and the next step is to save the layout. The next topic, Save the GUI Layout, tells you how to save it.