Main Content

MATLAB Coder

Generate C and C++ code from MATLAB code

MATLAB® Coder™ generates C/C++ code from MATLAB code for various hardware platforms, from desktop systems to embedded hardware. It supports most of the MATLAB language and a wide range of toolboxes. You can integrate the readable and portable generated code into your existing C/C++ projects as source code, static libraries, or dynamic libraries. MATLAB Coder lets you package the generated code as a MEX function for use in MATLAB. You can optimize the generated code by incorporating multicore and vectorized code and calling optimized libraries.

MATLAB Coder provides code customizations, hardware-specific optimizations, code traceability, code verification using software-in-the-loop (SIL) and processor-in-the-loop (PIL) testing, and code compliance with MISRA™ guidelines (with Embedded Coder®).

To deploy MATLAB programs on host platforms that MATLAB supports, use MATLAB Compiler™.

Get Started

Learn the basics of MATLAB Coder

MATLAB Programming for Code Generation

MATLAB language syntax and functions for code generation; data definition

Code Generation

C/C++ and MEX code generation, fixing errors, behavioral verification

Deployment

Using and running the generated C/C++ code

Performance

Reduce code generation time, improve execution speed, reduce memory usage of generated code

MATLAB Algorithm Acceleration

Acceleration using generated MEX functions

Numeric Conversion

Fixed-point conversion, single-precision conversion (requires Fixed-Point Designer™)

Deep Learning with MATLAB Coder

Generate C/C++ code for deep learning neural networks (requires Deep Learning Toolbox™)

MATLAB 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 www.mathworks.com/support/bugreports/. 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 R2025a Bug Reports

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