User`s guide

10 Examples of GUIDE GUIs
GUI Option Settings
GUIDE has a set of preferences called GUI Options, available from the Tools
menu. Two GUI Options settings are particularly important for this GUI:
Resize behavior: Proportional
Com mand-line accessibility: Callback
Proportional Resize Behavior. Selecting Proportional as the resize
behavior enables users to resize the GUI to better view the plots. Using this
option setting, when you resize the GUI, everything expands or shrinks
proportionately except text.
Callback Accessib ility of Object Handle s . When GUIs include axes, their
handles should be visible from other objects’ callbacks. This enables you to
use plotting commands like you would on the command line. Callback is the
default se t tin g for command-line accessibility.
For more information, see “G U I O ptions” on page 5-9.
Plot Push Button Callback
This GUI uses only the Plot button callback. You do not need to code
callbacks for the edit text components unless you want to validate their
inputs. W hen a user clicks the Plot button, the callback performs three basic
tasks: it gets user input from the edit text components, calculates data, and
creates the two plots.
Get User Input
Thethreeedittextboxesarewheretheuserentersvaluesforthetwo
frequencies and the time vector. The first task for the callback is to read
these values. This involves:
Reading the current values in the three edit text boxes using the
handles
structure to access the edit text handles.
Converting the two frequency values (
f1 and f2) from strings to doubles
using
str2double.
10-8