MATLAB Runtime Server | ![]() ![]() |
Adapting the Design for Runtime Execution
This example is a simple GUI-driven application that evaluates and plots a MATLAB expression. Its GUI is shown below.
To use the application, enter a valid MATLAB expression in the Plot field of the GUI and press the Draw button. The application plots the expression in its GUI. To erase the plot, press the Erase button.
Overview of Adaptations
myapp.m
incorporates several adaptations for Runtime Server execution:
Its figure
command includes the 'Menubar','none'
specification. This deactivates the GUI's default menus, as discussed in Preventing Command Window Input/Output.
myapp_draw.m
is embedded within an eval(
try
,
catch
)
statement in order to trap possible errors. If MATLAB encounters an error while trying to evaluate or plot the expression in myapp_draw
, then it executes the catch
expression, which calls myapp_error.m
to display an appropriate error message.
CloseRequestFcn
. Since the Myapp window is the top-level GUI figure window, its CloseRequestFcn
exits the application by calling myapp_quit.m
.
Also, the C program for this example is adapted for Runtime Server execution because its engOpen
command uses one of the flags
![]() | Preparing the Example Files | Organizing Files and Managing Startup Tasks | ![]() |