Controlling Figure Window Behavior Using Modal Figure Windows 520 Application Examples 6 GUI with Multiple Axes 6-2 View the Layout and guI M-File 6-3 Design of the GUI 6-3 Plot push Button callback 6-6 List Box Directory Reader 6-9 iew the Layout and GUI M-File Implementing the GuI 6-10 Specifying the Directory to List 6-10 Loading the list Box 611 Accessing Workspace Variables from a List Box 6-15 Techniques Used in This Example View the Layout and GUI M-File 6-16 Reading Workspace Variables 6-16 Reading the Selections from the List Box 6-17 A GUI to Set simulink model parameters Techniques Used in This Example View the Layout and GUI M-File 6-19 How to Use the GUI (Text of GUI Help Running the gUI Programming the Slider and Edit Text Components Running the Simulation from the GUI ..6-24 Removing Results from the list box 6-26 Plotting the results d The GUI Help Button 6-29 Closing the gui The list box callback and create Function
v Controlling Figure Window Behavior . . . . . . . . . . . . . . . . . . 5-20 Using Modal Figure Windows . . . . . . . . . . . . . . . . . . . . . . . . . . 5-20 6 Application Examples GUI with Multiple Axes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-2 Techniques Used in the Example . . . . . . . . . . . . . . . . . . . . . . . . 6-2 View the Layout and GUI M-File . . . . . . . . . . . . . . . . . . . . . . . . 6-3 Design of the GUI . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-3 Plot Push Button Callback . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-6 List Box Directory Reader . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-9 View the Layout and GUI M-File . . . . . . . . . . . . . . . . . . . . . . . . 6-9 Implementing the GUI . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-10 Specifying the Directory to List . . . . . . . . . . . . . . . . . . . . . . . . . 6-10 Loading the List Box . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-11 Accessing Workspace Variables from a List Box . . . . . . . . . 6-15 Techniques Used in This Example . . . . . . . . . . . . . . . . . . . . . . 6-15 View the Layout and GUI M-File . . . . . . . . . . . . . . . . . . . . . . . 6-16 Reading Workspace Variables . . . . . . . . . . . . . . . . . . . . . . . . . . 6-16 Reading the Selections from the List Box . . . . . . . . . . . . . . . . . 6-17 A GUI to Set Simulink Model Parameters . . . . . . . . . . . . . . 6-19 Techniques Used in This Example . . . . . . . . . . . . . . . . . . . . . . 6-19 View the Layout and GUI M-File . . . . . . . . . . . . . . . . . . . . . . . 6-19 How to Use the GUI (Text of GUI Help) . . . . . . . . . . . . . . . . . . 6-20 Running the GUI . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-21 Programming the Slider and Edit Text Components . . . . . . . . 6-22 Running the Simulation from the GUI . . . . . . . . . . . . . . . . . . . 6-24 Removing Results from the List Box . . . . . . . . . . . . . . . . . . . . 6-26 Plotting the Results Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-27 The GUI Help Button . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-29 Closing the GUI . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-29 The List Box Callback and Create Function . . . . . . . . . . . . . . 6-29
An Address book reader Techniques Used in This Example Managing Shared Data 333 View the Layout and GUI M-File 6-32 Running the gui 632 Loading an Address book Into the reader The Contact Name Callback 6-36 The Contact phone number callback Paging Through the Address Book- Prev/Next 6-39 ng Changes to the Address Book from the menu 6-41 The Create New Menu The Address book resize function vI Contents
vi Contents An Address Book Reader . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-31 Techniques Used in This Example . . . . . . . . . . . . . . . . . . . . . . 6-31 Managing Shared Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-31 View the Layout and GUI M-File . . . . . . . . . . . . . . . . . . . . . . . 6-32 Running the GUI . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-32 Loading an Address Book Into the Reader . . . . . . . . . . . . . . . . 6-34 The Contact Name Callback . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-36 The Contact Phone Number Callback . . . . . . . . . . . . . . . . . . . . 6-38 Paging Through the Address Book — Prev/Next . . . . . . . . . . . 6-39 Saving Changes to the Address Book from the Menu . . . . . . . 6-41 The Create New Menu . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-43 The Address Book Resize Function . . . . . . . . . . . . . . . . . . . . . . 6-43
Getting Started with GUIDE GUIDE- GUI Development Introduction to GUIDE and the layout Editor Environment(p. 1-2) GUI FIG-Files and M-Files(p. 1-5) How GUIDE stores GUIs Using GUIDE Templates(p 1-6) GUIDE provides templates -simple examples of GUIs, which
1 Getting Started with GUIDE GUIDE — GUI Development Environment (p. 1-2) Introduction to GUIDE and the Layout Editor GUI FIG-Files and M-Files (p. 1-5) How GUIDE stores GUIs Using GUIDE Templates (p. 1-6) GUIDE provides templates — simple examples of GUIs, which you can modify for your own purposes
1 Getting Started with GUIDE GUIDE- GUl Development Environment GUIDE, the MatLAB Graphical User Interface development environment t of tools for creating gUis. These tools greatly simplify th process of laying out and programming a GUI. This section introduces you to GUIDE and the layout tools it provides When you open a gui in guide, it is displayed in the layout Editor, which is the control panel for all of the guide tools. The Layout Editor enables you to lay out a gui quickly and easily by dragging components, such as push buttons, pop-up menus, or axes, from the component palette into the layout area. The following picture shows the Layout Editor 1-2
1 Getting Started with GUIDE 1-2 GUIDE — GUI Development Environment GUIDE, the MATLAB Graphical User Interface development environment, provides a set of tools for creating GUIs. These tools greatly simplify the process of laying out and programming a GUI. This section introduces you to GUIDE and the layout tools it provides. When you open a GUI in GUIDE, it is displayed in the Layout Editor, which is the control panel for all of the GUIDE tools. The Layout Editor enables you to lay out a GUI quickly and easily by dragging components, such as push buttons, pop-up menus, or axes, from the component palette into the layout area. The following picture shows the Layout Editor
GUIDE -GUI Development Environment Alignment Tool M-file edit rty Inspector Object Browser Run butto )untitled.fig 「郾以爵哈 Redo OKI Push Button O Radio Button 区 Checkb La Area EDIT Edit Tent Palette THT Static Text □ Frame IM Axes Figure Resize Tab Once you lay out your GUI and set each components properties, using the tools in the layout Editor, you can program the GUi with the M-file Editor. Finally, when you press the Run button on the toolbar, the functioning GUI appears outside the layout Editor window GUIDE To。lser For more information on the full set of GuidE development tools, see the following sections
GUIDE — GUI Development Environment 1-3 Once you lay out your GUI and set each component’s properties, using the tools in the Layout Editor, you can program the GUI with the M-file Editor. Finally, when you press the Run button on the toolbar, the functioning GUI appears outside the Layout Editor window. GUIDE Toolset For more information on the full set of GUIDE development tools, see the following sections: Component Palette Alignment Tool Menu Editor Property Inspector Run Button Layout Area Figure Resize Tab Undo Redo M-file Editor Object Browser