Get Started with MATLAB Coder
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™.
Tutorials
- STEP 1: Prepare MATLAB Function for Code Generation
- STEP 2: Automatically Define Input Types in the MATLAB Coder App
- STEP 3: Check for Code Generation Issues by Generating and Running a MEX Function
- STEP 4: Configure Code Generation Settings and Generate Code
- STEP 5: Verify Generated Code by Using SIL or PIL
- STEP 6: Optimize and Deploy Generated Code
- Diagnose Common Code Generation Errors and Warnings
Learn how to resolve common errors when generating C or C++ code from MATLAB code.
Generate Deployable Standalone Code by Using the MATLAB Coder App
Follow the steps of the code generation workflow to generate a standalone C++ dynamic linked library.
About Code Generation from MATLAB Algorithms
- Decide Which Code Generation Product to Use
Understand the differences between MATLAB Coder and other MathWorks® products.
- Input Type Specification for Code Generation
How input type specification affects the generated C/C++ code.
- Differences in Appearance of Generated Code and MATLAB Code
How generated code appears different from MATLAB code due to optimizations made by the code generator.
- Configure Code Generation and Build Settings
Configure code generation and build configuration parameters at the command line or in the MATLAB Coder app.
- Overview of Code Generation Using MATLAB Coder
The MATLAB Coder code generation workflow.
Featured Examples
Interactive Learning
MATLAB
Coder Onramp
Learn the basics of C and C++ code generation from MATLAB functions.
Videos
Generate C Code from MATLAB Code
Workflow for generating C/C++ code from MATLAB code.



