MATLAB SIMULINK 7 - GRAPHICAL USER INTERFACE Uživatelský manuál

Procházejte online nebo si stáhněte Uživatelský manuál pro Software MATLAB SIMULINK 7 - GRAPHICAL USER INTERFACE. Creating Graphical User Interfaces Uživatelská příručka

/ 330
Obsah
Creating Graphical User Interfaces
Version 7
M

ATLAB

®
The Language of Technical Computing

Soubor PDF · ·

Tisk

Tisknout dokument

Sdílení

Shrnutí obsahu

Strana 1 - Version 7

Creating Graphical User Interfaces Version 7 The Language of Technical Computing

Strana 2 - How to Contact The MathWorks:

How to Contact The MathWorks: www.mathworks.com Web comp.soft-sys.matlab Newsgroup www.mathworks.com/contact_TS.html Technical support…

Strana 3 - Revision History

Revision History November 2000 Online only New for MATLAB 6.0 (Release12) June 2001 Online only Revised for MATLAB 6.1 (Release 12.1) July 2002 Online…

Strana 5

v Contents Getting Started About GUIs in MATLAB What Is a GUI? 1-2 How Does a GUI Work? 1-3 Where Do I Start? 1-4 Creating a GUI with GUIDE GUIDE: A…

Strana 6

vi Contents Generating Data to Plot 2-19 Programming the Pop-Up Menu 2-21 Programming the Push Buttons 2-23 Running the GUI 2-26 Creating a GUI…

Strana 7

vii Creating GUIs with GUIDE What Is GUIDE? 4-2 Laying Out a GUI 4-2 Programming the GUI 4-2 GUIDE Tools Summary 4-3 Preferences and Options GUIDE…

Strana 8

viii Contents Selecting a GUI Template 6-5 Accessing the Templates 6-5 Template Descriptions 6-6 Setting the GUI Size 6-12 Adding Components to the…

Strana 9 - Saving and Running the GUI

ix Saving and Running the GUI Naming a GUI and Its Files 7-2 The GUI Files 7-2 File and GUI Names 7-3 How to Assign Names 7-3 Renaming GUIs and GUI…

Strana 10 - Contents

x Contents Callback Syntax and Arguments 8-11 Naming of Callback Functions 8-11 Changing Callback Names Assigned by GUIDE 8-12 Input Arguments 8-13…

Strana 11

xi Examples of GUIDE GUIs GUI with Multiple Axes 10-2 Techniques Used in the Example 10-2 View Completed Layout and Its GUI M-File 10-3 Design of the…

Strana 12

xii Contents The Contact Name Callback 10-38 The Contact Phone Number Callback 10-39 Paging Through the Address Book — Prev/Next 10-40 Saving Changes…

Strana 13 - Functions for Creating GUIs

xiii Creating GUIs Programmatically Functions for Creating GUIs Introduction 11-2 Function Summary 11-3 Predefined Dialog Boxes 11-3 Creating…

Strana 14

xiv Contents Techniques Used in the Example 25 View the Completed GUI M-File 25 Subfunction Summary 26 M-File Structure 27 GUI Programming Techniques…

Strana 15 - Getting Started

Getting Started These sections show you how to create a simple graphical user interface (GUI) using GUIDE, the MATLAB ® graphical user interface…

Strana 17 - About GUIs in MATLAB

About GUIs in MATLAB What Is a GUI? (p. 1-2) Explains a graphical user interface (GUI) from a GUI user’s perspective. How Does a GUI Work? (p. 1-3)…

Strana 18 - 1 About GUIs in MATLAB

1 About GUIs in MATLAB 1-2 What Is a GUI? A graphical user interface (GUI) is a graphical display that contains devices, or components, that enable a…

Strana 19 - How Does a GUI Work?

How Does a GUI Work? 1-3 How Does a GUI Work? Each component, and the GUI itself, is associated with one or more user-written routines known as…

Strana 20

1 About GUIs in MATLAB 1-4 Where Do I Start? First you have to design your GUI. You have to decide what you want it to do, how you want the user to…

Strana 21 - Creating a GUI with

Creating a GUI with GUIDE GUIDE: A Brief Introduction (p. 2-2) Introduces GUIDE, the graphical user interface development environment. The Example…

Strana 22 - 2 Creating a GUI with GUIDE

2 Creating a GUI with GUIDE 2-2 GUIDE: A Brief Introduction GUIDE, the MATLAB Graphical User Interface development environment, provides a set of…

Strana 23 - The Example: Simple GUI

The Example: Simple GUI 2-3 The Example: Simple GUI This chapter shows you how to use GUIDE to create the example graphical user interface (GUI) which…

Strana 24

2 Creating a GUI with GUIDE 2-4 Laying Out a Simple GUI “Opening a New GUI in the Layout Editor” on page 2-4 “Setting the GUI Figure Size” on page 2-6…

Strana 25 - OK. The Layout Editor then

Laying Out a Simple GUI 2-5 3 Display the names of the GUI components in the component palette. Select Preferences from the MATLAB File menu. Then…

Strana 26

2 Creating a GUI with GUIDE 2-6 Setting the GUI Figure Size Set the size of the GUI by resizing the grid area in the Layout Editor. Click on the…

Strana 27 - Adding the Components

Laying Out a Simple GUI 2-7 Adding the Components 1 Add the three push buttons to the GUI. For each push button, select the push button from the…

Strana 28

2 Creating a GUI with GUIDE 2-8 2 Add the remaining components to the GUI. A static text A pop-up menu An axes Arrange the components as shown in the…

Strana 29 - Aligning the Components

Laying Out a Simple GUI 2-9 Aligning the Components You can use the Alignment Tool to align components with respect to one another, if they have the…

Strana 30

2 Creating a GUI with GUIDE 2-10 4 Click OK. Your GUI now looks like this is the Layout Editor.

Zobrazit všech 330 stran
Strana 31

Laying Out a Simple GUI 2-11 Adding Text to the Components Although the push buttons, pop-up menu, and static text show some text in the Layout…

Strana 32

2 Creating a GUI with GUIDE 2-12 2 In the layout area select the top push button by clicking it. 3 In the Property Inspector, select the String…

Strana 33 - Entering Pop-Up Menu Items

Laying Out a Simple GUI 2-13 4 The push button label changes to Surf when you click outside the String field. 5 Select each of the remaining push…

Strana 34

2 Creating a GUI with GUIDE 2-14 3 Replace the existing text with the names of the three data sets: Peaks, Membrane, and Sinc. Press Enter to move to…

Strana 35 - , then click OK

Laying Out a Simple GUI 2-15 2 In the Property Inspector, click the button next to String. In the String dialog box that displays, replace the…

Strana 36

2 Creating a GUI with GUIDE 2-16 The Completed Layout In the Layout Editor, your GUI now looks like this and the next step is to save the layout. The…

Strana 37 - Saving the GUI Layout

Saving the GUI Layout 2-17 Saving the GUI Layout When you save a GUI, GUIDE creates two files, a FIG-file and an M-file. The FIG-file, with extension…

Strana 38

2 Creating a GUI with GUIDE 2-18 working directory to the directory containing the GUI files, or adding that directory to the top or bottom of the…

Strana 39

When you saved your GUI in the previous topic, “Saving the GUI Layout” on page 2-17, GUIDE created two files: a FIG-file simple_gui.fig that contains…

Strana 40

2 Creating a GUI with GUIDE 2-20 The cursor moves to the opening function which already contains this code: % --- Executes just before simple_gui is…

Strana 41 - Programming the Pop-Up Menu

% Create the data to plot. handles.peaks=peaks(35); handles.membrane=membrane; [x,y] = meshgrid(-8:.5:8); r = sqrt(x.^2+y.^2) + eps; sinc = sin(r)./r…

Strana 42

2 Creating a GUI with GUIDE 2-22 index of the selected string. The pop-up menu callback reads the pop-up menu Value property to determine what item is…

Strana 43 - Programming the Push Buttons

It then uses a switch statement to make the selected data set the current data. The last statement saves the changes to the handles structure. %…

Strana 44

2 Creating a GUI with GUIDE 2-24 The GUI M-file opens in the editor if it is not already open, and the cursor moves to the Surf push button callback…

Strana 45 - Save from the File menu

% Display contour plot of the currently selected data. contour(handles.current_data); 4 Save the M-file by selecting Save from the File menu. Your GUI…

Strana 46

2 Creating a GUI with GUIDE 2-26 Running the GUI In the previous topic, you programmed the pop-up menu and the push buttons. You also created data for…

Strana 47

Running the GUI 2-27 3 Try some of the other combinations before closing the GUI.

Strana 48

2 Creating a GUI with GUIDE

Strana 49 - Creating a GUI

Creating a GUI Programmatically The Example: Simple GUI (p. 3-2) Describes the example to be constructed. Function Summary (p. 3-4) Lists the…

Strana 50

3 Creating a GUI Programmatically 3-2 The Example: Simple GUI This chapter shows you how to write a script that creates the example graphical user…

Strana 51

The Example: Simple GUI 3-3 Subsequent topics guide you through the process of creating the GUI. This process begins with “Creating a GUI M-File” on…

Strana 52

3 Creating a GUI Programmatically 3-4 Function Summary MATLAB provides a suite of functions for creating GUIs. This topic introduces you to the…

Strana 53 - 3-D shaded surface plot

Function Summary 3-5 sin Sine; result in radians. sqrt Square root. surf 3-D shaded surface plot. Function Description

Strana 54 - Creating a GUI M-File

3 Creating a GUI Programmatically 3-6 Creating a GUI M-File Start by creating an M-file for the example GUI. 1 At the MATLAB prompt, type edit. MATLAB…

Strana 55

Laying Out a Simple GUI 3-7 Laying Out a Simple GUI This topic illustrates the basic steps for laying out a GUI. “Creating the Figure” on page 3-7…

Strana 56

3 Creating a GUI Programmatically 3-8 These statements use the uicontrol function to create the push buttons. Each statement uses a series of…

Strana 57

Laying Out a Simple GUI 3-9 5 Make your GUI visible by adding this command following the align command. set(f,'Visible','on') 6 This is what your…

Strana 58

3 Creating a GUI Programmatically 3-10 8 Type help simple_gui at the command line. MATLAB displays this help text. help simple_gui SIMPLE_GUI Select a…

Strana 59

Initializing the GUI 3-11 Initializing the GUI When you make the GUI visible, it should be initialized so that it is ready for the user. This topic…

Strana 60

3 Creating a GUI Programmatically 3-12 % Move the GUI to the center of the screen. movegui(f,'center') % Make the GUI visible. set(f,'Visible','on')…

Strana 61

Initializing the GUI 3-13 set([f,hsurf,hmesh,hcontour,htext,hpopup],... 'Units','normalized'); %Create a plot in the axes. current_data = peaks_data…

Strana 62

3 Creating a GUI Programmatically 3-14 Programming the GUI You use callbacks to program the GUI components. Callbacks are the functions that execute…

Strana 63

end The next topic, “Programming the Push Buttons” on page 3-15, shows you how to write callbacks for the three push buttons. Programming the Push…

Strana 64 - Contour push button, add the

3 Creating a GUI Programmatically 3-16 each component’s Callback property to specify the name of the callback with which it is associated. 1 To the…

Strana 65 - Running the Final GUI

Running the Final GUI 3-17 Running the Final GUI You have created the simple GUI. This topic shows you the final M-file and runs the GUI. “The Final…

Strana 66

3 Creating a GUI Programmatically 3-18 % Create the data to plot peaks_data = peaks(35); membrane_data = membrane; [x,y] = meshgrid(-8:.5:8); r =…

Strana 67

Running the Final GUI 3-19 end end % Push button callbacks. Each callback plots current_data in the % specified plot type. function…

Strana 68

3 Creating a GUI Programmatically 3-20 2 In the pop-up menu, select Membrane, then click the Mesh button. The GUI displays a mesh plot of the MATLAB…

Strana 69 - Creating GUIs with GUIDE

Creating GUIs with GUIDE These sections describe how to create graphical user interfaces (GUIs) using GUIDE, the MATLAB ® graphical user interface…

Strana 71 - What Is GUIDE?

What Is GUIDE? (p. 4-2) Introduces GUIDE, the MATLAB graphical user interface development environment. GUIDE Tools Summary (p. 4-3) Introduces the…

Strana 72 - 4 What Is GUIDE?

4 What Is GUIDE? 4-2 What Is GUIDE? GUIDE, the MATLAB Graphical User Interface development environment, provides a set of tools for creating graphical…

Strana 73 - GUIDE Tools Summary

GUIDE Tools Summary 4-3 GUIDE Tools Summary The GUIDE tools are available from the Layout Editor shown in the figure below. The tools are called out…

Strana 74

4 What Is GUIDE? 4-4 Tool Use This Tool To: Layout Editor Select components from the Component Palette, at the left side of the Layout Editor, and…

Strana 75

GUIDE Tools Summary 4-5 You can also set preferences that apply to all GUIs at creation, and options that are GUI-specific. See Chapter 5…

Strana 76

4 What Is GUIDE?

Strana 77 - Preferences and Options

Preferences and Options GUIDE Preferences (p. 5-2) MATLAB preferences for the GUIDE Layout Editor. GUI Options (p. 5-9) GUIDE options for individual…

Strana 78 - 5 Preferences and Options

5 Preferences and Options 5-2 GUIDE Preferences You can set preferences for the GUIDE Layout Editor by selecting Preferences from the MATLAB File…

Strana 79 - Prompt to Save on Activate

GUIDE Preferences 5-3 Prompt to Save on Activate When you activate a GUI by clicking the Run button , a dialog box informs you of the impending save…

Strana 80

5 Preferences and Options 5-4 Prompt to Save on Export When you select Export from the Layout Editor File menu, a dialog box informs you of the…

Strana 81 - All Other Preferences

GUIDE Preferences 5-5 All Other Preferences The GUIDE Layout Editor provides several other preferences. In the MATLAB Preferences dialog box, click…

Strana 82

5 Preferences and Options 5-6 The following topics describe the preferences in this dialog: “Show Toolbar” on page 5-6 “Show Names in Component…

Strana 83 - GUIDE Preferences

GUIDE Preferences 5-7 Show Names in Component Palette Displays both icons and names in the component palette, as shown below. When unchecked, the…

Strana 84

5 Preferences and Options 5-8 Show File Extension in Window Title Displays the filename with its file extension in the Layout Editor window title. If…

Strana 85 - GUI Options

GUI Options 5-9 GUI Options After opening a new GUI template in the Layout Editor, but before saving the GUI, you can configure various behaviors for…

Strana 86

5 Preferences and Options 5-10 Non-resizable — Users cannot change the window size (default). Proportional — MATLAB automatically rescales the…

Strana 87 - Generate FIG-File and M-File

GUI Options 5-11 Generate FIG-File and M-File Select Generate FIG-file and M-file in the GUI Options dialog if you want GUIDE to create both the…

Strana 88

5 Preferences and Options 5-12 GUIDE also adds a callback whenever you edit a callback routine from the Layout Editor’s right-click context menu and…

Strana 89 - Generate FIG-File Only

GUI Options 5-13 Note This option is available only if you first select the Generate FIG-file and M-File option. Generate FIG-File Only The Generate…

Strana 90

5 Preferences and Options 5-14 MATLAB versions 5.3 and earlier. See the guide command for more information. If you select Generate FIG-file only GUIDE…

Strana 91

Designing a GUI (p. 6-2) Things to think about when designing a GUI and references to other sources. Starting GUIDE (p. 6-4) Shows you all the ways to…

Strana 92

Designing a GUI Before creating the actual GUI, it is important to decide what it is you want your GUI to do and how you want it to work. It is…

Strana 93 - Designing a GUI

Designing a GUI 6-3 Many web sites and commercial publications such as the following provide guidelines for designing GUIs: AskTog – Essays on good…

Strana 94

Starting GUIDE There are many ways to start GUIDE. You can start GUIDE: From the command line by typing guide. From the Start menu by selecting MATLAB…

Strana 95

Selecting a GUI Template 6-5 Selecting a GUI Template GUIDE provides several templates that you can modify to create your own GUIs. The templates are…

Strana 96

2 Optionally, name your GUI now by selecting Save on startup as and typing the name in the field to the right. GUIDE saves the GUI before opening it…

Strana 97 - GUI with Uicontrols

Selecting a GUI Template 6-7 Select the blank GUI if the other templates are not suitable starting points for the GUI you are creating, or if you…

Strana 98

When you run the GUI by clicking the Run icon , the GUI appears as shown in the following figure. When a user enters values for the density and volume…

Strana 99 - GUI with Axes and Menu

Selecting a GUI Template 6-9 GUI with Axes and Menu The GUI with axes and menu template is shown in the following figure. When you run the GUI by…

Strana 100

You can select other plots in the pop-up menu. Clicking the Update button displays the currently selected plot on the axes. The GUI also has a File…

Strana 101 - Yes and No push buttons:

Selecting a GUI Template 6-11 Running the GUI displays the dialog box shown in the following figure: The GUI returns the text string Yes or No…

Strana 102

Setting the GUI Size Set the size of the GUI by resizing the grid area in the Layout Editor. Click on the lower-right corner and drag it until the GUI…

Strana 103 - Setting the GUI Size

Setting the GUI Size 6-13 3 In the Property Inspector, click the + sign next to Position. The elements of the component’s Position property are…

Strana 104

Adding Components to the GUI “Available Components” on page 6-14 “Adding Components to the Layout Area” on page 6-18 “Assigning an Identifier to Each…

Strana 105 - Preferences from

Adding Components to the GUI 6-15 When you first open the Layout Editor, the component palette contains only icons. To display the names of the GUI…

Strana 106

Component Description Push Button Push buttons generate an action when clicked. For example, an OK button might apply settings and close a dialog box.…

Strana 107

Adding Components to the GUI 6-17 Slider Sliders accept numeric input within a specific range by enabling the user to move a sliding bar, which is…

Strana 108

Adding Components to the Layout Area This topic tells you how to place components in the layout area and give each component a unique identifier. 1…

Strana 109

Adding Components to the GUI 6-19 the upper-left corner of the component to be, then setting the size of the control by dragging the cursor to the…

Strana 110

Adding a Component to a Panel or Button Group To add a component to a panel or button group, select the component in the component palette then move…

Strana 111

Adding Components to the GUI 6-21 If the component is not entirely contained in the panel or button group, it appears to be clipped in the layout…

Strana 112

You can use the Object Browser to determine the child objects of a panel or button group. “Viewing the Object Hierarchy” on page 6-62 tells you how.…

Strana 113

Adding Components to the GUI 6-23 1 Select the desired ActiveX control. The right panel shows a preview of the selected control. 2 Click Create, the…

Strana 114

See “ActiveX Control” on page 8-31 for information about programming a sample ActiveX control and an example. Assigning an Identifier to Each…

Strana 115 - Adding Text to the Components

Adding Components to the GUI 6-25 Adding Text to the Components Many components have labels, lists, or other text that distinguishes them. You can set…

Strana 116

2 The component label changes when you click outside the String field. Pop-Up Menu Pop-up menus display a list of choices. 1 In the Property…

Strana 117 - Static Text

Adding Components to the GUI 6-27 1 In the Property Inspector, click the button next to String. In the String dialog box that displays, replace the…

Strana 118

1 In the Property Inspector, click the button next to String. In the String dialog box that displays, type the text that you want to display when that…

Strana 119

Adding Components to the GUI 6-29 2 The list appears in the list box in the Layout Area with the top-most item selected. 3 If the list box is not…

Strana 120

and Min properties so that Max-Min>1. For example, Max=2, Min = 0. Set the Value property to the index of the item you want selected when the list box…

Strana 121 - Selecting Components

Adding Components to the GUI 6-31 3 If you want to change the position of the title, select the button next to TitlePosition in the Property…

Strana 122

Press Ctrl+A to select all child objects of the figure. This does not select components that are child objects of panels or button groups. Click and…

Strana 123 - Front-to-Back Positioning

Adding Components to the GUI 6-33 clipboard to the location of the last mouse click. It positions the upper left corner of the contents at the mouse…

Strana 124

Bring to Front — move the selected object(s) in front of nonselected objects (available from the right-click context menu, the Layout menu, or the…

Strana 125 - Dragging Components

Adding Components to the GUI 6-35 Dragging Components Select one or more components that you want to move, then drag them to the desired position and…

Strana 126

2 Click the + sign next to Position. The Property Inspector displays the elements of the Position property. 3 If you have selected only one component…

Strana 127 - Resizing Components

Adding Components to the GUI 6-37 Resizing Components You can resize components in one of the following ways: “Dragging a Corner of the Component” on…

Strana 128

3 Type the width and height you want the components to be. 4 Reset the Units property to characters. 5 Reset the Units property to its previous…

Strana 129 - Aligning Components

Aligning Components 6-39 Aligning Components The Layout Editor provides a number of features that facilitate alignment and distribution of components…

Strana 130

The alignment tool provides two types of alignment operations: Align — align all selected components to a single reference line. Distribute — space…

Strana 131 - Property Inspector

Aligning Components 6-41 All of the align options (vertical top, center, bottom and horizontal left, center, right) place the selected components with…

Strana 132

from left, distance from bottom, height, width]. The values are given in the units specified by the Units property of the component. 1 Select the…

Strana 133 - Guide Lines

Aligning Components 6-43 Use the Grid and Rulers dialog (select Grid and Rulers from the Tools menu) to: Control visibility of rulers, grid, and guide…

Strana 134

Guide lines used for horizontal alignment Click on the top or left ruler and drag the guide to the desired position Guide line used for vertical…

Strana 135 - Setting Tab Order

Setting Tab Order 6-45 Setting Tab Order A GUI’s tab order is the order in which components of the GUI are selected when a user presses the Tab key on…

Strana 136

To examine and change the tab order of the panel components, click the panel background to select it, then select Tab Order Editor in the Tools menu…

Strana 137 - 3 Mesh push button

Setting Tab Order 6-47 arrow to move the component up or down in the list. If you set the tab order for the three components in the example to be 1…

Strana 138

Creating Menus GUIDE enables you to create two kinds of menus: “Menus for the Menu Bar” on page 6-49 — drop-down menus whose titles appear on the…

Strana 139 - Menus for the Menu Bar

Creating Menus 6-49 Note In general, programming conventions described for components in Chapter 8, “Programming the GUI” also apply to menu items.…

Strana 140

Note By default, GUIDE selects the Menu Bar tab when you open the Menu Editor. 2 Click on the menu title to display a selection of menu properties in…

Strana 141 - Adding Items to a Menu

Creating Menus 6-51 Adding Items to a Menu Use the New Menu Item tool to create menu items that are displayed in the drop-down menu. 1 Add an Open…

Strana 142

You can also: Choose a keyboard accelerator for the menu item with the Accelerator pop-up menu. In combination with Ctrl, this is the keyboard…

Strana 143 - Cascading Menus

Creating Menus 6-53 this field, GUIDE automatically sets the value using a combination of the Tag field and the GUI filename. See “Menu Item” on page…

Strana 144

Note See “Menu Item” on page 8-37 for information about programming menu items. Laying Out Three Menus The following Menu Editor illustration shows…

Strana 145 - Creating Menus

Creating Menus 6-55 When you run the GUI, the menu titles appear in the menu bar.

Strana 146

Context Menus A context menu is displayed when a user right-clicks on the object for which the menu is defined. The Menu Editor enables you to define…

Strana 147

Creating Menus 6-57 Adding Items to the Context Menu Use the New Menu Item tool to create menu items that are displayed in the context menu. 1 Add a…

Strana 148

2 Fill in the Label and Tag fields for the new menu item. For example, set Label to 'Blue background color' and set Tag to 'blue_background'. Click…

Strana 149 - UIContextMenu property

Creating Menus 6-59 Display a check next to the menu item when the menu is first opened by checking Check mark this item. A check indicates the…

Strana 150

In the GUI M-file, complete the callback subfunction for each item in the context menu. Each callback executes when a user selects the associated…

Strana 151 - Creating Toolbars

Creating Toolbars 6-61 Creating Toolbars GUIDE provides no tool to enable you do add a toolbar. However, you can add a toolbar by adding code to the…

Strana 152

Viewing the Object Hierarchy The Object Browser displays a hierarchical list of the objects in the figure, including both components and menus. As you…

Strana 153 - Default System Font

Designing for Cross-Platform Compatibility 6-63 Designing for Cross-Platform Compatibility You can create GUIs that behave more consistently when run…

Strana 154

Specifying a Fixed-Width Font If you want to use a fixed-width font for a user interface control (uicontrol), set its FontName property to the string…

Strana 155 - Generate FIG-file

Designing for Cross-Platform Compatibility 6-65 systems, e.g., the standard shade of gray on the PC differs from that on UNIX, and may not match the…

Strana 156

Cross-Platform Compatible Units Cross-platform compatible GUIs should look correct on computers having different screen sizes and resolutions. Since…

Strana 157

Designing for Cross-Platform Compatibility 6-67 Units property back to characters, and the components’ Units properties to characters (nonresizable…

Strana 158

6 Laying Out a GUI

Strana 159 - Saving and Running the

Saving and Running the GUI Naming a GUI and Its Files (p. 7-2) Describes the GUI files and how they are named. Saving a GUI (p. 7-5) Describes the…

Strana 160 - 7 Saving and Running the GUI

7 Saving and Running the GUI 7-2 Naming a GUI and Its Files “The GUI Files” on page 7-2 “File and GUI Names” on page 7-3 “How to Assign Names” on page…

Strana 161 - How to Assign Names

Naming a GUI and Its Files 7-3 File and GUI Names The M-file and the FIG-file that define your GUI must have the same name. This name is also the name…

Strana 162

7 Saving and Running the GUI 7-4 By selecting the Save or Save as options on the File menu GUIDE prompts you for a name before saving the GUI. The…

Strana 163 - Saving a GUI

Saving a GUI 7-5 Saving a GUI This section tells you how to save a GUI you have constructed in GUIDE. “Ways to Save a GUI” on page 7-5 “Saving a New…

Strana 164

7 Saving and Running the GUI 7-6 Clicking the Save icon on the Layout Editor toolbar Selecting the Save or Save as options on the File menu Clicking…

Strana 165 - Saving a New GUI

Saving a GUI 7-7 Note that button groups and panels are introduced in MATLAB 7.0, and you should not use them in GUIs that you expect to run in…

Strana 166

7 Saving and Running the GUI 7-8 3 Change the directory if you choose, and then enter the name you want to use for the FIG-file. Be sure to choose a…

Strana 167 - Saving an Existing GUI

Saving a GUI 7-9 6 If you chose Yes in the previous step, GUIDE displays a dialog that asks if you want to replace the existing M-file or append to…

Strana 168

7 Saving and Running the GUI 7-10 Running a GUI Generally, you run your GUI by executing the M-file that GUIDE generates. This M-file contains the…

Strana 169 - From an M-file Script

Running a GUI 7-11 If a GUI accepts arguments when it is run, they are passed to the GUI’s opening function. See “Opening Function” on page 8-15 for…

Strana 170

7 Saving and Running the GUI 7-12 Saving and Displaying Only the GUI Layout “Saving a GUI Layout Only” on page 7-12 “Displaying a GUI Layout Only” on…

Strana 171 - M-file

Saving and Displaying Only the GUI Layout 7-13 open('mygui.fig') openfig('mygui') hgload('mygui') You can run a GUI that has no M-file only if you set…

Strana 172

7 Saving and Running the GUI

Strana 173

Callbacks: An Overview (p. 8-2) Introduces the functions, referred to as callbacks, that you use to program GUI behavior. GUI Files: An Overview (p.…

Strana 174

Callbacks: An Overview After you have laid out your GUI, you need to program its behavior. The code you write controls how the GUI responds to events…

Strana 175 - Callbacks: An Overview

Callbacks: An Overview 8-3 Each kind of callback has a triggering mechanism or event that causes it to be called. The following table lists the…

Strana 176

Note User interface controls include push buttons, sliders, radio buttons, check boxes, editable text boxes, static text boxes, list boxes, and toggle…

Strana 177 - GUI Files: An Overview

GUI Files: An Overview 8-5 GUI Files: An Overview “M-Files and FIG-Files” on page 8-5 “GUI M-File Structure” on page 8-6 “Adding Callback Templates to…

Strana 178

GUI M-File Structure The GUI M-file that GUIDE generates is a function file. The name of the main function is the same as the name of the M-file. For…

Strana 179 - View callbacks

GUI Files: An Overview 8-7 Adding Callback Templates to an Existing GUI M-File When you save the GUI, GUIDE automatically adds templates for some…

Strana 180

Associating Callbacks with Components A GUI can have many components and GUIDE provides a way of specifying which callback should run in response to a…

Strana 181

Associating Callbacks with Components 8-9 - When you save the GUI, GUIDE constructs the name of the callback by appending an underscore ( _) and the…

Strana 182

See “Input Arguments” on page 8-13 for information about the callback input arguments. When you save the GUI, GUIDE also opens the GUI M-file in your…

Strana 183 - Callback Syntax and Arguments

Callback Syntax and Arguments 8-11 Callback Syntax and Arguments GUIDE defines conventions for callback syntax and arguments and implements these…

Strana 184

When GUIDE generates the template, it creates the callback name by appending an underscore (_) and the name of the callback property to the…

Strana 185 - The Handles Structure

Callback Syntax and Arguments 8-13 References in the M-file to the field of the handles structure that contains the component’s handle. See “The…

Strana 186

handles = figure1: 160.0011 edit1: 9.0020 uipanel1: 8.0017 popupmenu1: 7.0018 pushbutton1: 161.0011 output: 160.0011 GUIDE creates and maintains the…

Strana 187 - Initialization Callbacks

Initialization Callbacks 8-15 Initialization Callbacks GUIDE automatically includes two callbacks, the opening function and the output function, in…

Strana 188

% Choose default command line output for mygui handles.output = hObject; % Update handles structure guidata(hObject, handles); % UIWAIT makes mygui…

Strana 189 - Output Function

Initialization Callbacks 8-17 handles.output = hObject adds a new element, output, to the handles structure and assigns it the value of the input…

Strana 190

% Get default command line output from handles structure varargout{1} = handles.output; Input Arguments The output function has three input arguments…

Strana 191 - Push Button

Examples: Programming GUI Components 8-19 Examples: Programming GUI Components This section provides basic code examples to get you started…

Strana 192

function pushbutton1_Callback(hObject, eventdata, handles) display Goodbye delete(handles.figure1); Adding an Image to a Push Button or Toggle Button…

Strana 193 - Check Box

Examples: Programming GUI Components 8-21 elseif button_state == get(hObject,'Min') % Toggle button is not pressed-take appropriate action ... end…

Strana 194

function checkbox1_Callback(hObject, eventdata, handles) if (get(hObject,'Value') == get(hObject,'Max')) % Checkbox is checked-take approriate action…

Strana 195 - List Box

Examples: Programming GUI Components 8-23 Triggering Callback Execution For both UNIX and Windows, clicking inside the GUI but outside the edit text…

Strana 196

function listbox1_Callback(hObject, eventdata, handles) index_selected = get(handles.listbox1,'Value'); list = get(handles.listbox1,'String')…

Strana 197

Examples: Programming GUI Components 8-25 is fixed, then you can use this approach. Else, you can use the index to retrieve the actual string for the…

Strana 198

Note To set Resize behavior for the figure to Other (Use ResizeFcn), select GUI Options from the Layout Editor Tools menu. 1 This example of a…

Strana 199

Examples: Programming GUI Components 8-27 For radio buttons and toggle buttons that are managed by a button group, you must include the code to…

Strana 200

plotting of a graph to an axes. In this case, the button’s Callback callback contains the code that generates the plot. This example plots a graph in…

Strana 201

Examples: Programming GUI Components 8-29 Plotting to a GUI with Multiple Axes If a GUI has multiple axes, explicitly specify which axes you want to…

Strana 202

2 Add this code to the Plot 2 push button’s Callback callback. The contour function displays the contour plot of a matrix, in this case the output of…

Strana 203 - ActiveX Control

Examples: Programming GUI Components 8-31 default). From the Layout Editor select Tools -> GUI Options -> Command Line Accessibility: Callback . See…

Strana 204

2 Activate the GUI by clicking the Run icon on the toolbar and save the GUI when prompted. GUIDE displays the GUI shown in the following figure and…

Strana 205 - View Callbacks from

Examples: Programming GUI Components 8-33 3 View the ActiveX Properties with the Property Inspector. Select the control in the Layout Editor, and then…

Strana 206

If you click the GUI enough times, the circle disappears entirely. Programming a User Interface Control to Update an ActiveX Control This topic…

Strana 207

Examples: Programming GUI Components 8-35 handles.default_radius = handles.activex1.radius; 3 In the activex1_Click callback, reset the slider’s Value…

Strana 208

at the MATLAB prompt. This displays the available methods in a new window, as shown in the following figure. Alternatively, you can enter…

Strana 209 - Menu Item

Examples: Programming GUI Components 8-37 Compiling a GUI that Contains an ActiveX Control If you use the MATLAB Compiler mcc command to compile a GUI…

Strana 210

When a user selects the to file option under the Edit menu’s Copy option, only the to file callback is required to perform the action. Suppose…

Strana 211 - View button

Examples: Programming GUI Components 8-39 Note From the Menu Editor, you can view a menu item’s Callback callback in your editor by selecting the menu…

Strana 212

8 Programming the GUI

Strana 213 - Application-Defined Data

Managing Application-Defined Data Mechanisms for Managing Data (p. 9-2) Describes various mechanisms for managing application-defined data. Explains…

Strana 214 - Mechanisms for Managing Data

9 Managing Application-Defined Data 9-2 Mechanisms for Managing Data Most GUIs generate or use data that is specific to the application. This topic…

Strana 215 - GUI Data in GUIDE

Mechanisms for Managing Data 9-3 GUI data provides application developers with a convenient interface to a figure’s application data: You do not need…

Strana 216 - Application Data

9 Managing Application-Defined Data 9-4 2 Use the following command to save the data. guidata(hObject,handles) where hObject is the handle of the…

Strana 217

Mechanisms for Managing Data 9-5 The following table summarizes the functions that provide access to application data. For more detailed information…

Strana 218 - UserData Property

9 Managing Application-Defined Data 9-6 1 Use getappdata to retrieve the structure. From the example in the previous topic, the name of the…

Strana 219 - GUI Data

Sharing Data Among a GUI’s Callbacks 9-7 Sharing Data Among a GUI’s Callbacks You can use GUI data, application data, and the UserData property to…

Strana 220

9 Managing Application-Defined Data 9-8 The GUI behavior is as follows: When a user moves the slider, the text box displays the slider’s current…

Strana 221

Sharing Data Among a GUI’s Callbacks 9-9 3 Set the slider value from the edit text Callback callback. The edit text Callback sets the slider’s value…

Strana 222

9 Managing Application-Defined Data 9-10 functions setappdata, getappdata, isappdata, and rmappdata to manage application data. See “Application Data”…

Strana 223

Sharing Data Among a GUI’s Callbacks 9-11 % Retrieve and increment the error count. slider_data = getappdata(handles.figure1,'slider')…

Strana 224

9 Managing Application-Defined Data 9-12 2 Set the edit text value from the slider Callback callback. Add this statement to the slider Callback.…

Strana 225

GUI with Multiple Axes (p. 10-2) Analyze data and generate frequency and time domain plots in the GUI figure. List Box Directory Reader (p. 10-9) List…

Strana 226

GUI with Multiple Axes This example creates a GUI that contains two axes for plotting data. For simplicity, this example obtains data by evaluating an…

Strana 227 - Design of the GUI

GUI with Multiple Axes 10-3 View Completed Layout and Its GUI M-File If you are reading this in the MATLAB Help browser, you can click the following…

Strana 228

To create the default values, set the String property of the edit text. The following figure shows the value set for the time vector. Identifying the…

Strana 229 - GUI Option Settings

GUI with Multiple Axes 10-5 For example, the Tag of the axes used to display the FFT is set to frequency_axes. Therefore, within a callback, you…

Strana 230

like you would on the command line. Note that Callback is the default setting for command-line accessibility. See “GUI Options” on page 5-9 for more…

Strana 231 - Plot Button Code Listing

GUI with Multiple Axes 10-7 Making the appropriate axes current using the axes command and the handle of the axes. For example…

Strana 232

plot(t,x) set(handles.time_axes,'XMinorTick','on') grid on

Strana 233 - List Box Directory Reader

List Box Directory Reader 10-9 List Box Directory Reader This example uses a list box to display the files in a directory. When the user double clicks…

Strana 234

Note The following links execute MATLAB commands and are designed to work within the MATLAB Help browser. If you are reading this online or in PDF…

Strana 235

List Box Directory Reader 10-11 First input argument is not a directory, but is a character string and there is more than one argument — execute the…

Strana 236

% Populate the listbox load_listbox(initial_dir,handles) Loading the List Box This example creates a subfunction to load items into the list box. This…

Strana 237 - The List Box Callback

List Box Directory Reader 10-13 guidata(handles.figure1,handles) set(handles.listbox1,'String',handles.file_names,... 'Value',1)…

Strana 238

If the selection is a file — get the file extension (fileparts) to determine if it is a FIG-file, which is opened with guide. All other file types are…

Strana 239 - for more information

List Box Directory Reader 10-15 does not take this approach for FIG-files since openfig.m is required by the GUI M-file. See open for more…

Strana 240

Accessing Workspace Variables from a List Box This GUI uses a list box to display workspace variables, which the user can then plot. Techniques Used…

Strana 241 - Reading Workspace Variables

Accessing Workspace Variables from a List Box 10-17 View Completed Layout and Its GUI M-File If you are reading this in the MATLAB Help browser, you…

Strana 242

Enabling Multiple Selection To enable multiple selection in a list box, you must set the Min and Max properties so that Max Min > 1. This requires you…

Strana 243

Accessing Workspace Variables from a List Box 10-19 Callbacks for the Plotting Buttons The callbacks for the plotting buttons call get_var_names to…

Strana 244

A GUI to Set Simulink Model Parameters This example illustrates how to create a GUI that sets the parameters of a Simulink® model. In addition, the…

Strana 245 - Changing the Controller Gains

A GUI to Set Simulink Model Parameters 10-21 all component properties and to understand how the components are assembled to create the GUI. You can…

Strana 246

Running the Simulation Once you have set the gain values, you can run the simulation by clicking the Simulate and store results button. The simulation…

Strana 247 - Slider Callback

A GUI to Set Simulink Model Parameters 10-23 Determine if the model is open (find_system). Open the block diagram for the model and the subsystem…

Strana 248

Calls model_open to ensure that the Simulink model is open so that simulation parameters can be set. Gets the new slider value. Sets the value of the…

Strana 249 - Current value text box

A GUI to Set Simulink Model Parameters 10-25 Here is the callback for the Kf Current value text box. function KfCurrentValue_Callback(hObject…

Strana 250

Here is the Simulate and store results button callback. function SimulateButton_Callback(hObject, eventdata, handles)…

Strana 251

A GUI to Set Simulink Model Parameters 10-27 set(handles.ResultsList,'String',ResultsStr); % Store the new ResultsData handles.ResultsData =…

Strana 252

% Store the new ResultsData guidata(hObject, handles) Plotting the Results Data The GUI Plot button callback creates a plot of the run data and adds a…

Strana 253 - The GUI Help Button

A GUI to Set Simulink Model Parameters 10-29 % Get data to plot and generate command string with color % specified legendStr =…

Strana 254

The which command returns the full path to the file when it is on the MATLAB path The web command displays the file in the Help browser. This is the…

Strana 255

A GUI to Set Simulink Model Parameters 10-31 In this case, there is no need for the list box callback to execute, so you should delete it from the GUI…

Strana 256

An Address Book Reader This example shows how to implement a GUI that displays names and phone numbers, which it reads from a MAT-file. Techniques…

Strana 257 - Running the GUI

An Address Book Reader 10-33 An index pointer that indicates the current name and phone number, which must be updated as the user pages through the…

Strana 258

GUI M-file options selected: Generate callback function prototypes Application allows only one instance to run Calling the GUI You can call the GUI…

Strana 259 - Validating the MAT-file

An Address Book Reader 10-35 & the second element is a MATLAB file, then load that file elseif (length(varargin) == 2 && ...…

Strana 260

Check_And_Load Code Listing This is the Check_And_Load function. function pass = Check_And_Load(file,handles) % Initialize the variable "pass" to…

Strana 261 - Open_Callback Code Listing

An Address Book Reader 10-37 guidata(handles.Address_Book,handles) else errordlg('Not a valid Address Book','Address Book Error') end The Open Menu…

Strana 262

The Contact Name Callback The Contact Name text box displays the name of the address book entry. If you type in a new name and press enter, the…

Strana 263 - Cancel from the question

An Address Book Reader 10-39 set(handles.Contact_Name,'string',Addresses(i).Name) set(handles.Contact_Phone,'string',Addresses(i).Phone) handles.Index…

Strana 264

dialog. Both the current address book and the index pointer are saved in the handles structure so that this data is available to other callbacks. If…

Strana 265 - Code Listing

An Address Book Reader 10-41 Determining Which Button Is Clicked The callback defines an additional argument, str, that indicates which button, Prev…

Strana 266

% If the index is less than one then set it equal to the index % of the last element in the Addresses array if i < 1 i = length(Addresses); end case…

Strana 267 - Save_Callback Code Listing

An Address Book Reader 10-43 the Contact_Name_Callback or the Contact_Phone_Callback updates handles.Addresses. Saving the MAT-File If the user…

Strana 268

save(File,'Addresses') handles.LastFile = File; guidata(hObject, handles) end end The Create New Menu The Create New menu simply clears the Contact…

Strana 269 - Changing the Height

An Address Book Reader 10-45 Changing the Width If the new width is greater than the original width, set the figure to the new width. The size of the…

Strana 270

Original_Size = [ 0 0 94 19.230769230769234]; % If the resized figure is smaller than the % original figure size then compensate. if…

Strana 271

Using a Modal Dialog to Confirm an Operation 10-47 Using a Modal Dialog to Confirm an Operation This example illustrates how to use the modal dialog…

Strana 272

Note The following links execute MATLAB commands and are designed to work within the MATLAB Help browser. If you are reading this online or in PDF…

Strana 273

Using a Modal Dialog to Confirm an Operation 10-49 Setting Up the GUI with the Close Button To set up the second GUI with a Close button, do the…

Strana 274

% eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) 9 After these…

Strana 275 - How the GUI and Dialog Work

Using a Modal Dialog to Confirm an Operation 10-51 Clicking the Yes button closes both the close dialog and the GUI that calls it. Clicking the No…

Strana 276

Updates the output field in the handles structure Executes uiresume to return control to the opening function where uiwait is called. 5 The output…

Strana 277 - Programmatically

Creating GUIs Programmatically This section provides examples of graphical user interfaces (GUIs) created programmatically. Note Following the release…

Strana 279 - Functions for Creating

Functions for Creating GUIs Introduction (p. 11-2) Introduces the topic. Function Summary (p. 11-3) Summarizes MATLAB functions specifically intended…

Strana 280 - Introduction

11 Functions for Creating GUIs 11-2 Introduction MATLAB provides a selection of functions for creating GUIs. Some of these create standard dialog…

Strana 281 - Function Summary

Function Summary 11-3 Function Summary “Predefined Dialog Boxes” on page 11-3 “Creating Components” on page 11-3 “ActiveX Controls” on page 11-4…

Strana 282 - Working with Preferences

11 Functions for Creating GUIs 11-4 ActiveX Controls Using Application-Defined Data Interactive User Input Working with Preferences uitoggletool…

Strana 283 - Utilities

Function Summary 11-5 Utilities setpref Set preference uigetpref Open dialog box for retrieving preferences uisetpref Manage preferences used in…

Strana 284

11 Functions for Creating GUIs

Strana 285 - Examples of GUIs Created

Examples of GUIs Created Programmatically Introduction (p. 12-8) Introduces the examples and lists the programming techniques they illustrate. GUI…

Strana 286

Introduction This chapter provides three examples that illustrate the application of certain techniques in programmatically created GUIs. “GUI with…

Strana 287 - The Example

GUI with Axes, Menu, and Toolbar 12-9 GUI with Axes, Menu, and Toolbar The initial topics introduce the example and the techniques it illustrates…

Strana 288

You can select other plots in the pop-up menu. Clicking the Update button displays the currently selected plot on the axes. The GUI File menu has…

Strana 289 - Creating the Data

GUI with Axes, Menu, and Toolbar 12-11 Techniques Used in the Example This example illustrates the following techniques: Passing input arguments to…

Strana 290 - The Main Figure

mOutputArgs = {}; % Variable for storing output when GUI returns mPlotTypes is a 5-by-2 cell array that holds the data to be plotted in the axes. The…

Strana 291 - The Axes

GUI with Axes, Menu, and Toolbar 12-13 The figure function creates the GUI figure. Setting the MenuBar and Toolbar properties to none, prevents the…

Strana 292 - The Update Push Button

Note If you specify the Units property, then the Position property, and any other properties that depend on the value of the Units property, should…

Strana 293 - File, and the items it

GUI with Axes, Menu, and Toolbar 12-15 The uicontrol function creates various user interface controls based on the value of the Style property. This…

Strana 294 - The Toolbar and Its Tools

Here, setting the Parent property of the File menu to hMainFigure makes it the child of the main figure. This statement creates a menu bar in the…

Strana 295 - Initializing the GUI

GUI with Axes, Menu, and Toolbar 12-17 The uipushtool TooltipString property assigns a tool tip that displays when the GUI user moves the mouse…

Strana 296 - Defining the Callbacks

Defining the Callbacks This topic defines the callbacks that service the components of the GUI. Because the callback definitions are at a lower level…

Strana 297 - Open Menu Item Callback

GUI with Axes, Menu, and Toolbar 12-19 Note MATLAB automatically passes hUpdateButtonCallback two arguments, hObject and eventdata, because the Update…

Strana 298 - Close Menu Item Callback

Print Menu Item Callback The hPrintMenuitemCallback function services the Print menu item and the Print toolbar button . Selecting the menu item or…

Strana 299

GUI with Axes, Menu, and Toolbar 12-21 if strcmp(selection,'No') return; end delete(hMainFigure); end The hCloseMenuitemCallback function calls the…

Strana 300 - Color Palette

Color Palette The color palette example includes these topics: “The Example” on page 12-22 “Techniques Used in the Example” on page 12-25 “View the…

Strana 301 - Using the Color Palette

Color Palette 12-23 The Components The colorPalette includes the following components: An array of color cells defined as toggle buttons An Eraser…

Strana 302 - NaN, that

Displays the selected color in the preview area. The red, green, and blue values for the newly selected color are displayed in the R, G, and B fields…

Strana 303 - View the Completed GUI M-File

Color Palette 12-25 The colorPalette function accepts property value pairs as input arguments. Only the custom property Parent is supported. This…

Strana 304 - Subfunction Summary

Note The following link executes MATLAB commands and is designed to work within the MATLAB Help browser. If you are reading this online or in PDF, you…

Strana 305 - M-File Structure

Color Palette 12-27 Note Three eventdata fields are defined for use with button groups ( uibuttongroup). These fields enable you to determine the…

Strana 306 - GUI Programming Techniques

2 Data creation. Because the example uses nested functions, defining this data at the top level makes the data accessible to all functions without…

Strana 307

Color Palette 12-29 Passing Input Arguments to a GUI Inputs to the GUI are custom property/value pairs. colorPalette allows one such property: Parent.…

Strana 308 - Sharing Data Between Two GUIs

2 If it finds a match, processUserInputs assigns the value that was input for the property to its variable in the third column of the mPropertyDefs…

Strana 309

Color Palette 12-31 Just before returning, colorPalette assigns mOutputArgs the function handle for its getSelectedColor helper function and then…

Strana 310

% update color of the selected block mIconCData(y, x,:) = color; localUpdateIconPlot(); end end

Strana 311 - Icon Editor

Icon Editor 12-33 Icon Editor The icon editor example includes these topics: “The Example” on page 12-33 “Techniques Used in the Example” on page…

Strana 312 - Using the Icon Editor

The Components The GUI includes the following components: A edit text that instructs the user or contains the name of the file to be edited. The edit…

Strana 313

Icon Editor 12-35 3 Erase the color in some squares. Click the Eraser button on the palette Click in specific squares to erase those squares Click and…

Strana 314

Note The following links execute MATLAB commands and are designed to work within the MATLAB Help browser. If you are reading this online or in PDF…

Strana 315

Icon Editor 12-37 The example also includes the helper functions listed in the following table. M-File Structure The iconEditor is programmed using…

Strana 316

3 GUI figure and component creation. 4 Command line input processing. 5 GUI initialization. 6 Block execution of the program until the GUI user clicks…

Strana 317 - Cancel button, its callback

Icon Editor 12-39 Returning Only After the User Makes a Choice At the end of the initialization code, and just before returning, iconEditor calls…

Strana 318

Passing Input Arguments to a GUI Inputs to the GUI are custom property/value pairs. iconEdit allows three such properties: IconWidth, IconHeight, and…

Strana 319

Icon Editor 12-41 1 processUserInputs sequences through the inputs, if any, and tries to match each property name to a string in the first column of…

Strana 320

% different platforms prepareLayout(hMainFigure); prepareLayout first uses findall to retrieve the handles of all objects contained in the figure. The…

Strana 321

Icon Editor 12-43 Background Color. The default component background color is the standard system background color on which the GUI is running. This…

Strana 322 - Making a GUI Modal

Character units are defined by characters from the default system font. The width of a character unit equals the width of the letter x in the system…

Strana 323

Icon Editor 12-45 function color = getSelectedColor % function returns the currently selected color in this % colorPlatte color = mSelectedColor; The…

Strana 324

iconEditor calls prepareLayout with the handle of the main figure, in the initialization section of the M-file. prepareLayout(hMainFigure); First…

Strana 325

Icon Editor 12-47 height of a character unit is the distance between the baselines of two lines of text. Note that character units are not square.

Strana 326

12 Examples of GUIs Created Programmatically

Strana 327 - UserData property 9-6

Index-1 Index A ActiveX controls adding to layout 6-22 programming 8-31 aligning components in GUIDE 6-39 Alignment Tool GUIDE 6-39 application data…

Strana 328

Index Index-2 cross-platform compatibility GUI background color 6-64 GUI design 6-63 GUI fonts 6-63 GUI units 6-66 D data sharing among GUI callbacks…

Strana 329

Index Index-3 GUI object hierarchy viewing in GUIDE 6-62 GUI options (GUIDE) function prototypes 5-11 singleton 5-11 system color background 5-11 GUI…

Strana 330 - UserData property

Index Index-4 M-file generated by GUIDE 5-11 moving components in GUIDE 6-34 N naming a GUI in GUIDE 7-2 O Object Browser (GUIDE) 6-62 opening .fig…

Další dokumenty pro Software MATLAB SIMULINK 7 - GRAPHICAL USER INTERFACE

Otázky k MATLAB SIMULINK 7 - GRAPHICAL USER INTERFACE

K tomuto návodu zatím nejsou žádné otázky. Položte první.

Položit otázku

Odpovídáme podle návodu a uvádíme stranu. Otázka se na webu zobrazí po kontrole.

Všechny otázky a odpovědi ›

Související produkty a manuály pro Software MATLAB SIMULINK 7 - GRAPHICAL USER INTERFACE