Software-in-the-Loop Execution From Command Line
Use software-in-the-loop (SIL) execution to verify the numerical behavior of the generated C/C++ code with reference to your original MATLAB® functions.
To set up and start a SIL execution from the command line:
Configure the object for SIL.
codegenfunction to generate library code for your MATLAB function and the SIL interface.
coder.runTestfunction to run the test file for your original MATLAB function.
To terminate the SIL execution, use the
The following example shows how you can set up and run a SIL execution from the command line.
Tutorial Files: Kalman Filter
Open this example to obtain the files for this tutorial:
kalman01.m— MATLAB function for the Kalman estimator
test01_ui.m— MATLAB file to test
plot_trajectory.m— File that plots actual target trajectory and Kalman estimator output
position.mat— Input data
SIL Execution of Code Generated for a Kalman Estimator
Suppose that the MATLAB current working directory (the folder that
pwd displays) is a UNC path
\\server\a\b\c) on a Windows platform. If you launch a SIL executable from this path, the
location where the SIL executable is launched can be unpredictable and different
from the MATLAB current working directory (for example,
To fix this issue, use a mapped network drive for the UNC path as your MATLAB current working directory.
- Generate C Code by Using the MATLAB Coder App
- Software-in-the-Loop Execution with the MATLAB Coder App
- Debug Generated Code During SIL or PIL Execution
- Generate Execution Time Profile
- Generate Stack Usage Profile