Main Content

Simulink Coder

Generate C and C++ code from Simulink and Stateflow models

Simulink® Coder™ (formerly Real-Time Workshop®) generates and executes C and C++ code from Simulink models, Stateflow® charts, and MATLAB® functions. The generated source code can be used for real-time and non-real-time applications, including simulation acceleration, rapid prototyping, and hardware-in-the-loop testing. You can tune and monitor the generated code using Simulink or run and interact with the code outside MATLAB and Simulink.

Get Started

Learn the basics of Simulink Coder

Model Architecture and Design

Model componentization, hierarchy, and execution order considerations for code generation

Code Interface Configuration and Integration

Configure code generation for data and functions to facilitate software integration

Code Generation

C/C++ code generation and debugging, report generation


Deployment of executable programs and shared libraries


Reduce memory usage and improve execution speed of generated code


Compare model and generated code simulation results

Simulink Coder Supported Hardware

Support for third-party hardware

Check Bug Reports for Issues and Fixes

Software is inherently complex and is not free of errors. The output of a code generator might contain bugs, some of which are not detected by a compiler. MathWorks reports critical known bugs brought to its attention on its Bug Report system at In the search bar, type the phrase "Incorrect Code Generation" to obtain a report of known bugs that produce code that might compile and execute, but still produce wrong answers. To save a search, click Save Search.

The bug reports are an integral part of the documentation for each release. Examine periodically all bug reports for a release, as such reports may identify inconsistencies between the actual behavior of a release you are using and the behavior described in this documentation.

In addition to reviewing bug reports, you should implement a verification and validation strategy to identify potential bugs in your design, code, and tools.

Search R2022b Bug Reports

Known Bugs for Incorrect Code Generation
All Known Bugs for This Product