In external mode, you must first create an executable target application. The Simulink® Coder™ code generation software creates C code from your Simulink model. The bundled C compiler compiles and links that C code into a real-time application.
This procedure uses the model sldrtex_model
. To open this model,
in the MATLAB Command Window, type:
open_system(docpath(fullfile(docroot,'toolbox',... 'sldrt','examples','sldrtex_model')))
It assumes that you have already loaded that model.
In the Simulink Editor, from the Apps tab, click Desktop Real-Time.
This operation select configuration parameters for use by the Simulink Coder code generation software. See Set External Mode Code Generation Parameters.
On the Desktop Real-Time tab, click Run in Real Time.
The Simulink
Coder code generation software creates the C code source files
sldrtex_model.c
and
sldrtex_model.h
.
The build process creates the makefile sldrtex_model.mk
from the template makefile sldrt.tmf
.
The build process creates the real-time application by using
sldrtex_model.mk
. On Windows®, the build process creates the binary file
sldrtex_model.rxw64
. On Mac OS, it creates the binary file
sldrtex_model.rxm64
.
The binary file sldrtex_model.rx*64
is referred to as a
real-time application. You can run the real-time application with the
Simulink
Desktop Real-Time™ kernel.
After you create a real-time application, you can exit MATLAB®, and restart MATLAB again, and then connect and run the executable without rebuilding your code. For more information, see Execute Real-Time Application in External Mode by Using Step by Step Commands.