Generate C and C++ code from MATLAB code
MATLAB Coder™ generates C and C++ code from MATLAB® code for a variety of 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 generated code into your projects as source code, static libraries, or dynamic libraries. The generated code is readable and portable. You can incorporate your existing C code and libraries to get the ultimate efficiency for the key parts of your algorithm, or to reuse code you trust. You can also package the generated code as a MEX-function for use in the MATLAB environment for verification or acceleration.
Embedded Coder® enhances MATLAB Coder for production use with support for code customization, target-specific optimizations, code traceability, and software-in-the-loop (SIL) and processor-in-the-loop (PIL) verification.
Deploy Algorithms Royalty-Free
Use any C compiler to compile and run your generated code on any hardware, from desktop systems to mobile devices to embedded hardware. The generated code is royalty-free—deploy it in commercial applications to your customers at no charge.
MATLAB Coder Success Stories
Learn how engineers and scientists in a variety of industries use MATLAB Coder to generate C code for their applications.
Supported Toolboxes and Functions
MATLAB Coder generates code from a broad range of MATLAB language features that design engineers use to develop algorithms as components of larger systems. This includes over 1900 operators and functions from MATLAB and companion toolboxes.
Prototype on Hardware
Get to hardware fast with automatic conversion of your algorithm to C.
Prototype on Desktop and Cloud Platforms
Use the MATLAB Coder app or equivalent command-line functions to quickly generate code for your signal processing, computer vision, deep learning, control systems, or other application and then compile the code for your hardware.
Prototype on Embedded and Mobile Platforms
Target any device by manually integrating the generated code with your application. Automate the process for Raspberry Pi™ using MATLAB Support Package for Raspberry Pi.
Move from Prototyping to Production
Use MATLAB Coder with Embedded Coder® to generate code that takes advantage of processor-specific intrinsics that can execute faster than standard ANSI/ISO C/C++ code.
Integrate with Software
Reuse MATLAB algorithms as C code within your software environment.
Generate Code with Simple Interfaces That Are Easy to Integrate
Generated code uses C types in a natural way, simplifying integration with external code. You can integrate generated code as source code or libraries. Trusted C libraries or components can be brought into MATLAB for higher-fidelity testing and are automatically called from generated code as well.
Optimize the Performance of Generated Code
Apply optimizations to adjust tradeoffs between execution speed, memory usage, readability, and portability. Use profiling tools to identify bottlenecks. To further boost performance, generate multicore OpenMP code and call optimized libraries such as LAPACK, BLAS, and FFTW when available.
Reuse MATLAB Tests on Generated Code Prior to Integration
Reuse existing MATLAB tests to verify the behavior of generated code in the interactive MATLAB environment. Use the MATLAB unit test framework to quickly develop a rich set of regression tests that can be used to verify the generated C code.
Generate C code and compile it for use inside MATLAB.
Accelerate Algorithms on CPUs
You can call generated code as MEX functions from your MATLAB code to speed execution, though performance will vary depending on the nature of your MATLAB code. You can profile generated MEX functions to identify bottlenecks and focus your optimization efforts.
Accelerate Algorithms Using GPUs
Use Parallel Computing Toolbox™ to accelerate algorithms running in MATLAB. Use GPU Coder™ to generate CUDA code for acceleration or deployment that runs on any modern NVIDIA® GPU.
Generate code for YOLO v2 and MobileNet-v2 networks for Arm and Intel processors
Generate C++ code that has more C++ language and object-oriented features
Generate Code for More MATLAB Data Types
categorical, duration, and table
Code Generation Report Object
Access code insights and build logs programmatically
See execution times of generated MEX functions in MATLAB Profiler
Optimization Toolbox Code Generation
Generate code for nonlinear constrained optimization using
Statistics and Machine Learning Toolbox Code Generation
Generate code for probability distribution functions
Use MATLAB Coder features in MATLAB Online
Learn tips and best practices for working with MATLAB Coder and read about successful applications of generated code by companies such as Delphi, Baker Hughes, iSonea, and dorsaVi.