【实例简介】
Matlab界面GUI编程官方教程2017版
Revision History
November 2000 Online only
New for MatLAB 6.0 (Release 12)
June 2001
Online only
Revised for MatLab 6.1 (Release 12.1)
July 2002
Online only
Revised for MatLAB 6.6( Release 13
June 2004
Online only
Revised for MaTLAb 7.0 ( Release 14
October 2004
Online only
Revised for MATLAB 7.0.1(Release 14SP1)
March 2005
Online only
Revised for MATLAB 7.0.4 (Release 14SP2)
September 2005 Online Only
Revised for MatLAB 7. 1 (Release 14SP3
March 2006
Online only
Revised for MatLAB 7.2 (Release 2006a)
May 2006
Online only
Revised for matlab 7.2
September 2006 Online Only
Revised for MaTLAB 7.3(Release 2006b)
March 2007
Online only
Revised for MATLAB 7. 4(Release 2007a)
September 2007 Online only
Revised for MatlAB 7.5 ( Release 2007b)
March 2008
Online only
Revised for MaTLAB 7.6(Release 2008a)
October 2008
Online onl
Revised for MatLAB 7. 7 (Release 2008b)
March 2009
Online only
Revised for MatlaB 7. 8 (Release 2009a)
September 2009 Online only
Revised for MaTLAB 7.9(Release 2009b)
March 2010
Online only
Revised for MatlAB 7. 10 (Release 2010a)
September 2010 Online Onl
Revised for MatlAB 7. 11 (Release 2010b)
April 2011
Online only
Revised for MATLAB 7.12 (Release 2011a)
September 2011 Online only
Revised for MatLAB 7. 13 (Release 2011b)
March 2012
Online only
Revised for MaTLAB 7 14 Release 2012a
September 2012 Online only
Revised for MaTLaB 8.0(Release 2012b
March 2013
Online only
Revised for MaTlAB8 1(Release 2013a
September 2013 Online Only
Revised for MatlaB 8.2(Release 2013b)
March 2014
Online only
Revised for matlab 8.3 (Release 201 4a)
October 2014
Online only
Revised for MaTlAB 8.4(Release 2014b)
March 2015
Online only
Revised for Matlab 8.5 ( Release 2015a)
September 2015 Online Only
Revised for matlab 8.6 (Release 2015b
March 2016
Online only
Revised for MatlaB 9.0 ( Release 2016a
September 2016 Online Only
Revised for matlab 9.1 (Release 2016b)
March 2017
Online onl
Revised for MATLAB 9.2 (Release 2017a)
Contents
Introduction to Creating uis
About apps in MATLAB Software
Ways to Build Apps
1-2
Use GUIDE
Use MATLAB Functions to Create Apps
Programmatically
1-3
Use App designer
1-5
How to Create a app with GuiDe
2
Create a Simple app Using GUIdE
2-2
Open a New ui in the guide Layout editor
2-3
Set the Window size in GUIDE
2-5
Layout the UI
2-6
Code the Behavior of the App
2-16
Run the App
2-22
Files generated by guide
2-24
Code files and fig-files
2-24
Code file structure
2-24
Adding Callback Templates to an Existing Code File.. 2-25
about guide-generated callbacks
2-26
A Simple Programmatic App
3
Create a Simple app programmatically
3-2
Create a code file
3-3
Create the Figure window
3-3
Add Components to the UI
3-4
Code the Apps Behavior
3-7
Verify Code and run the app
3-11
Create UIs with GUIDE
What Is guide?
GUIDE: Getting Started
4-2
UI Layout
4-2
UI Programming
4-2
GUIDE Preferences and options
5
GUIDE Preferences
5-2
Set Preferences
5-2
Confirmation Preferences
5-2
Backward Compatibility preference
All Other preferences
GUIDE Options
5-8
The GUI Options Dialog Box
5-8
Resize behavior
5-9
Command-Line Accessibility
5-9
Generate FIG-File and MATLAB file
5-10
Generate FIG-Flle Only
5-12
i Contents
Lay out a ui Using GUide
GUIDE Templates
6-2
Access the Templates
6-2
Template Descriptions
6-3
Set the ui window size in guide
6-11
Prevent Existing Objects from Resizing with the
Window
6-11
Set the Window Position or size to an exact value
6-12
Maximize the layout area
6-12
Add components to the guide layout area
6-13
Place Components
6-13
User Interface Controls
6-19
Panels and Button groups
6-40
Axe
6-45
Table
6-49
ActiveX Component
6-60
Resize guide ui components
6-62
Align GUIDE UI Components
6-65
Align objects T
6-65
Property Inspector
6-68
Grid and rule
6-71
Guide lines
6-72
Customize Tabbing Behavior in a GUIDE UI
6-74
Create Menus for GUIDE Apps
6-77
Menus for the menu bar
6-77
Context menus
6-87
Create Toolbars for GUIDE UIs
6-94
Toolbar and tools
6-94
Editing Tool Icons
6-102
Design Cross-Platform UIs in GUIDE
6-105
Default System Font
6-105
Standard background Color
6-106
Cross-Platform Compatible Units
6-106
Programming a guIdE app
7
Write callbacks in guide
7-2
Callbacks for different User Actions
7-2
GUIDE-Generated Callback Functions and Property
Values
7-4
GUIDE Callback Syntax
7-5
Renaming and removing gUidE-Generated callbacks
7-5
Initialize UI Components in GUIDE Apps
7-7
Opening function
7-7
Output Function
7-9
Callbacks for Specific Components
7-11
How to Use the Example code
7-11
Push button
7-12
Toggle butto
7-12
Radio butt
7-13
Check box
7-14
Edit Text field
7-14
Slide
7-15
List box
7-16
Pop-Up Menu
7-18
Panel
7-20
Button gro
7-21
Menu item
7-22
Table
7-25
Axes
7-26
Examples of GUIDE Apps
7-29
Examples of GUIDE UIs
8
Modal Dialog Box in GUIDE
8-2
Create the Dialog Box
8-2
Create the Program That Opens the Dialog Box
8-3
Run the Program
Contents
GUIDE App with Parameters for Displaying Plots
8-7
Open and Run the Example
8-7
Examine the Code
8-8
GUIDE App Containing Tables and Plots
8-12
Open and Run the Example
8-12
Examine the Code
8-13
Interactive List Box App in GUIDE
8-16
Open and Run The Example
8-16
Examine the Layout and callback Code
8-18
Plot Workspace Variables in a GUIDE App
8-21
Open and Run the Example
8-21
Examine the Code
8-22
Automatically Refresh Plot in a gUIdE App
8-24
Open and Run the Example
8-24
Examine the Code
8-25
Create UIs Programmatically
Lay out a Programmatic UI
9
Structure of Programmatic App Code Files
9-2
File Organization
9-2
File Template
9-2
Run the program
9-3
Add Components to a Programmatic App
9-4
User Interface Controls
9-4
ables
9-16
Panels
9-17
Button Groups
9-19
Axes
9-21
ActiveX Controls
9-23
how to set Font characteristics
9-23
Lay out a ui Programmatically
9-26
Component Placement and sizing
9-26
Managing the layout in Resizable uis
9-31
Manage the Stacking Order of Grouped Components
9-34
Customize Tabbing Behavior in a Programmatic App
9-35
How Tabbing Works
9-35
Default Tab Order
9-35
Change the Tab Order in the uipanel
9-37
Create Menus for Programmatic Apps
9-39
Add menu bar menus
9-39
Add Context Menus to a Programmatic App
9-46
Create Toolbars for Programmatic Apps
9-52
Use the uitoolbar function
9-52
Commonly Used Properties
9-52
To
molars
9-53
Display and modify the standard Toolbar
9-56
DPIAware behavior in matlaB
9-59
Visual appearance
9-59
Using Object Properties
9-61
Using print, getframe, and publish Functions.... 9-62
Code a Programmatic App
10
Initialize a Programmatic App
10-2
Examples
10-2
Write Callbacks for Apps Created Programmatically
10-5
Callbacks for different User actions
10-5
How to Specify Callback Property values
10-7
Contents
【实例截图】
【核心代码】