Main Content

Processor-in-the-Loop Execution From Command Line

Use processor-in-the-loop (PIL) execution to verify code that you intend to deploy in production.

To set up and start a PIL execution from the command line:

  1. Create, register, and verify your target connectivity configuration.

  2. Create a coder.EmbeddedCodeConfig object.

  3. Configure the object for PIL.

  4. Use the codegen function to generate library code for your MATLAB® function and the PIL interface.

  5. Use the coder.runTest function to run the test file for your original MATLAB function.

To terminate the PIL execution, use the clear function_pil or clear mex command.

The following example shows how you can use line commands to set up and run a PIL execution on your development computer.

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 kalman01.m

  • plot_trajectory.m — File that plots actual target trajectory and Kalman estimator output

  • position.mat — Input data

PIL Execution of Code Generated for a Kalman Estimator

  1.  Create a target connectivity API implementation

  2.  Register a target connectivity configuration

  3.  Verify target connectivity configuration

  4.  Configure the PIL execution

  5.  Generate code and run PIL execution

  6.  Terminate PIL execution

Related Examples

More About