Main Content

Generate C++ Code from Simulink Models

This example shows you how to generate C++ code from a Simulink® model of a key ignition system by using the Embedded Coder® product.

To generate and review code for deployment to an embedded system, you can prepare your model for code generation by using the Embedded Coder Quick Start tool. Then, using code tools accessible from the Simulink Editor, you configure code interfaces, initiate code generation, and review the generated code.

Example Model

This tutorial uses the CppClassWorkflowKeyIgnition example model.

The CppClassWorkflowKeyIgnition model represents a key ignition system in the greater control system of a vehicle engine. When the ignition is turned on, the keyState input signal changes state and the control system waits a delay before switching the output engineState.


By using this tutorial, you learn how to:

  • Generate C++ code by using the Embedded Coder Quick Start tool.

  • Configure the C++ class interface.

  • Deploy the generated C++ code.

For the first task, see Generate C++ Code by Using Embedded Coder Quick Start.

Copyright 2022 The MathWorks, Inc.