Get Started with 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™.
Installation and Configuration
Tutorials
- Generate C Code by Using the MATLAB Coder App
Use the MATLAB Coder app to generate C code from an example MATLAB function.
- Generate C Code at the Command Line
Use command line tools to generate C code from an example MATLAB function.
- Accelerate MATLAB Algorithm by Generating MEX Function
Use command line tools to generate a MEX function from an example MATLAB function.
Code Generation Quick Start
- STEP 1: Prepare MATLAB Code for Code Generation
- STEP 2: Generate C/C++ Code from MATLAB Code
- STEP 3: Test Generated C/C++ Code
- STEP 4: Deploy Generated C/C++ Code
Code Generation Guide: Generate Deployable C/C++ Code
Prepare MATLAB code for code generation and generate C/C++ code.
About Code Generation from MATLAB Algorithms
- Overview of Code Generation Using MATLAB Coder
The MATLAB Coder code generation workflow.
- 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.
Featured Examples
Generate C/C++ Code from a MATLAB Function
Generate C/C++ code from a MATLAB function using the codegen command.
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.


