MATLAB Creating Graphical User Interfaces

(Barry) #1

9 Examples of GUIDE UIs


To get and view the example code:

1 Copy the example FIG-file and code file to your current (writeable) folder and open
the FIG-file in GUIDE with the following commands:

copyfile(fullfile(docroot, 'techdoc','creating_guis','examples',...
'f14ex*.*')), fileattrib('f14ex*.*', '+w')
guide f14ex.fig

(^2) From GUIDE Layout Editor, click the Editor button.
The f14ex.m code displays in the MATLAB Editor.
How to Use the UI
Note:You must have Simulink installed for this program to run. The first time you run
the program, Simulink opens (if it is not already running) and loads the f14 example
model. This can take several seconds.
The UI has a Help button. Clicking it opens an HTML file, f14ex_help.html, in the
Help Browser. This file, which resides in the examples folder along with the UI files,
contains the following five sections of help text:
F14 Controller Gain Editor
You can use the F14 Controller Gain Editor to analyze how changing the gains used in
the Proportional-Integral Controller affect the aircraft's angle of attack and the amount
of G force the pilot feels.
Note that the Simulink diagram f14.mdl must be open to run this program. If you
close the F14 Simulink model, the program reopens it whenever it requires the model to
execute.
Change the Controller Gains
You can change gains in two blocks:
1 The Proportional gain (Kf) in the Gain block
2 The Integral gain (Ki) in the Transfer Function block

Free download pdf