Post on 28-Aug-2018
Handle Graphics, GUI, GUIDE GUI GUIDE
1
Contents
(Handle Graphics) GUI: M file GUI: GUIDE
2
(Handle Graphics)
(Object)
(Handle)()
3
Hierarchy
4
Ex.:
5
: MATLAB (GUIGraphical User Interface)
: MATLAB
6
: MATLAB propedit
ex.:>>peaks; % peaks 3D >>propedit; %
propedit:
: Edit/Figure Properties
7
(ex.)
8
:
- set- get- findobj
9
Ex.: set
set(h) h
>> h=plot(humps);>> set(h, linestyle)>> set(h)
10
Ex.: set
11
Ex.: get
12
>> get(h, 'LineWidth') % ans =3; >> get(h, 'Color') % ans =
0 0 1 >> get(h) % h
Ex.: findobj
13
>> plot(rand(10,2)); % >> h=findobj('type', 'line') %
h =172.0011171.0022
>> set(h, 'LineWidth',3); % 3(Figure)
Contents
(Handle Graphics) GUI: M file GUI: GUIDE
14
MATLAB GUI
MATLAB GUI (Graphic User Interface) M GUIDE
15
GUI: M
M GUI uicontrol Mouse Events
Example: xpsoundtraveltrusslorenz
16
Ex.: uicontrol
17
UI
UicontrolUI (User Interface) Push Button
Ex.: uicontrol
19
Ex.: uicontrol: ui01.m
20
Ex.: uicontrol: cb2.m; cb3.m
21
Ex.: uicontrol ()
- , - MATLAB
: Switchyard() Programming
- tag
22
Ex.: uicontrol: tag
23
Ex.: uicontrol: tag
24
Ex.: uicontrol: tag
25
GUI: M
M GUI uicontrol Mouse Events
Example: xpsoundtraveltrusslorenz
26
(Mouse Events)
WindowButtonDownFcn WindowButtonMotionFcn WindowButtonUpFcn
27
WindowButtonMotionFcn WindowButtonUpFcn
WindowButtonMotionFcn WindowButtonUpFcn
WindowButtonMotionFcn
28
Ex.:: mouse01.m
29
Ex.:
30
31
Contents
(Handle Graphics) GUI: M file GUI: GUIDE
32
GUIDE
GUIDE: Graphic User Interface Design Environment ( GUI)
GUIDE -
- :
GUIDE - GUI - GUI -
33
GUIDE GUIDE: guide
34
GUIDE Create New GUI
Blank GUI (Default) GUI with Uicontrols UI UI Controls GUI with Axes and Menu Modal Question Dialog
Open Existing GUI
35
GUIDE Blank GUI (Default): : figure & function (, .m)
36
GUIDE Figure:
- : UI - : UI
GUIDE - :
- File/Preference- Show names in component palette
- (Ruler):- Tools/Grid and Rulers- Show rulers
37
Example 1 GUIDE : ()
- Edit Text: - Slider
38
Example 1
Inspect Properties: UI
39
Example 1: Inspect Properties : : () :
- e.g. slider- : slider,slider(: 0 ~ 1 )
-: : slider GUIDE
- - : _Callback
40
Example 1 sliderView Callbacks/Callback
=> MATLAB slider Tag: slider1 (fig) : slider1_Callback()
41
Example 1
edit1_Callback()
42
Example 1
.fig: , GUI : GUIDE
MATLAB
43
Example 1 GUI : slider, slider : , slider
44
Example 1
- UI - UI
GUIDE handles-
- handles - handles UI
45
Example 1: handles
A
A
handles.myData = A; % A handles myData guidata(hObject, handles) % handles GUI
A = handles.myData;
46
Example 1
handles GUI
handles.slider1slider handles.edit1
47
Example 2 :
- GUIDE gui01_Test- File/Save As gui02_Test- GUIDE gui02_Test.m- gui02_Test_OpeningFcn()
48
Example 2 :
49
Example 2
7
50
Example 4: () :
51
Example 4 MATLAB : View/View
Callback/CreateFcn : gui04_Test_OpeningFcn()
peaks;
52
Example 4: : : Tools/Menu Editor : : , ,
53
Example 4: : => : ,
54
Example 4
: View=> MATLAB
Shading/faceted shading faceted
Shading/interp shading interp
Shading/flat shading flat
Colormap/Gray colormap gray
Colormap/Cool colormap cool
Colormap/Summer colormap summer
55
Example 4
56
() (Object Browsers) GUIDE View/Object Browser :
57
() : GUIDE Tools/Align Objects :
58