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 nonreal-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. 

Generating Code

Simulink Coder generates C and C++ for Simulink models, MATLAB functions, and Stateflow charts. It supports a wide variety of Simulink add-on products, including Simscape™, Vehicle Dynamics Blockset™, and Computer Vision Toolbox™.

Configuring Options

Simulink Coder lets you configure code and data options using apps and APIs. Use Code Generation Advisor to optimize for speed or debugging. 

Explore gallery (2 images).

Integrating Legacy Code

You can incorporate hand-written, existing C/C++ code using the C Caller block or the Legacy Code Tool to enable simulation and integration with generated code.

Integrating legacy code with the Legacy Code Tool.

Viewing the Status of Parallel Builds

You can view the status of in-progress parallel builds using the build status user interface. This information can help you identify ways to improve parallel builds by modifying the referenced model hierarchy.

Building status user interface.

Executing Code

Simulink Coder uses your third-party compiler to generate executables for real-time and nonreal-time simulation of embedded controllers, autonomous systems, and physical systems modeled in Simulink with add-on products.

Real-Time Simulation and Testing

Test and prototype your embedded system design using hardware-in-the-loop simulation and rapid prototyping on a wide variety of real-time machines, including Speedgoat target computer hardware with Simulink Real-Time™.

Speedgoat hardware for rapid prototyping and hardware-in-the-loop simulation. 

Desktop System Simulation

Generate and test code for your system on your host computer using rapid batch or Monte Carlo simulations.

Deploying to Embedded Targets

Run code from your models on supported embedded targets for project-based learning, using a library of I/O blocks for configuring and accessing peripherals and communication interfaces.

Explore gallery (2 images).

Tuning Parameters and Logging Data

With Simulink Coder you can assess and optimize your design within Simulink while the code is executing on external devices by viewing data and tuning parameters using scopes, dashboards, and live-stream data plots.

External Mode Simulation with XCP Communication

Simulink Coder supports signal logging and streaming via Dashboard blocks and the Simulation Data Inspector. You can stream signals from a model hierarchy over XCP, TCP/IP, and serial (RS-232) communication.

Explore gallery (2 images).

Host-Based ASAP2 Data Exchange

Generate host-based ASAP2 data definition files for use in third-party data measurement, calibration, and diagnostic systems.

Data Exchange Between Generated and Hand-Written Code

Access Simulink block outputs and MATLAB parameters from hand-written code using a target-based C API.

Exchanging data between generated and external code using the C API.

Latest Features

Messages

Model and generate C++ code for software compositions with message-based communication

Row-Major Layout

Use row-major array layout in Stateflow charts and MATLAB Function blocks to integrate your model with row-major algorithms

Duplicate Enumeration Member Names

Control duplicate enumeration member names in the generated code

Simulink Coder Contextual Tabs on the Simulink Toolstrip

Use contextual tabs to assist you in your Simulink code generation workflow

Simulink Coder Quick Start

Quickly generate code for rapid prototyping from your Simulink model

See the release notes for details on any of these features and corresponding functions.

Go Further with Simulink Coder and Related Products

You can generate highly-optimized and customized code for embedded systems using Embedded Coder and generate code for automated real-time test systems with Simulink Real-Time.

Get a Free Trial

30 days of exploration at your fingertips.

Download now

Ready to Buy?

Get pricing information and explore related products.

Are You a Student?

Get MATLAB and Simulink student software.

Learn more