Using Figures and Graphics
|
GUIDE calls the
figure
function to
create the app window.
GUIDE calls the
axes
function to create axes for
displaying plots.
All MATLAB graphics functions are supported. There is no
need to specify the target axes.
|
App Designer calls the
uifigure
function to create the app window.
App Designer
calls the
uiaxes
function to create
axes for displaying plots.
Most MATLAB graphics functions are
supported.
|
Display Graphics in App Designer
|
Using Components
|
GUIDE creates most components with the
uicontrol
function. Fewer
components are available.
|
App Designer creates each UI component with its own
dedicated function. More components are available, including
Tree
,
Gauge
,
TabGroup
, and
DatePicker
.
|
App Building Components
Update UIControl Objects and Callbacks
|
Accessing Component Properties
|
GUIDE uses
set
and
get
to access component properties,
and uses
handles
to specify a
component.
For example,
name =
get(handles.Fig,'Name')
|
App Designer supports
set
and
get
, but encourages the use of dot
notation to access component properties, and uses
app
to specify a component.
For example,
name =
app.UIFigure.Name
|
Callbacks in App Designer
|
Managing App Code
|
The code is defined as a main function that can call
local functions. All code is editable.
|
The code is defined as a MATLAB class. Only callbacks, helper functions, and
custom properties are editable.
|
Manage Code in App Designer Code View
|
Writing Callbacks
|
Required callback input arguments are
handles
,
hObject
,
eventdata
.
example,
myCallback(hObject,eventdata,handles)
|
Required callback input arguments are
app
and
event
.
example,
myCallback(app,event)
|
Callbacks in App Designer
|
Sharing Data
|
To store and share data between callbacks and
functions, use the
UserData
property,
the
handles
structure, or the
guidata
,
setappdata
, or
getappdata
function.
example,
handles.currSelection
selection;
guidata(hObject,handles);
|
To store and share data between callbacks and
functions, use custom properties to create variables.
example,
app.currSelection =
selection
|
Share Data Within App Designer Apps
|