MATLAB Creating Graphical User Interfaces

(ff) #1

See “App with Auto-Reflow that Updates Plot Based on User Selections” on page 18-4
for an example of an app that has a StartupFcn callback.


Define Input App Arguments


The StartupFcn callback is also the function where you can define input arguments for
your app. Input arguments are useful for letting the user (or another app) specify initial
values when the app starts up.


To add input arguments to an app, open the app in App Designer and click Code View.


Then click App Input Arguments in the Editor tab.


The App Input Arguments dialog box allows you to add or remove input arguments in
the function signature of the StartupFcn callback. The app argument is always first, so
you cannot change that part of the signature. Enter a comma-separated list of variable
names for your input arguments. You can also enter varargin to make any of the
arguments optional. Then click OK.


Startup Tasks and Input Arguments in App Designer
Free download pdf