MATLAB Coder

 

MATLAB Coder

Generate C and C++ code from MATLAB code

Video length is 1:28
Screenshot of generated C code for a matrix multiply operation.

Run Anywhere

Use any C/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.

An athlete starting a race with overlaid pose estimation.

Use Functions from Toolboxes

Use the MATLAB Coder app or equivalent command-line functions to generate code for signal processing, computer vision, deep learning, control system, and other applications using MATLAB products.

Four different embedded development boards.

Prototype on Embedded Hardware

Get to hardware fast with automatic conversion of your algorithm to C/C++. 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.

MATLAB code implementing a simple class object and equivalent generated C++ class code.

Deploy C++ Code from MATLAB

Generate C++ classes from classes in your MATLAB code, including value classes, handle classes, and System objects. Compile the generated code into C++ libraries or executables and integrate them into your existing C++ application.

Screenshot of generated C code, including calls to OpenMP.

Optimize the Generated Code

Generate SIMD instructions, parallelize loops with multicore OpenMP code, and call optimized libraries such as LAPACK, BLAS, and FFTW. Use with Embedded Coder to generate processor-specific intrinsic code for even faster execution.

Plots of seizure, pre-seizure, and normal EEG time-series data alongside their corresponding scalograms.

Deploy Deep Learning Networks and Machine Learning Models

Deploy a variety of trained networks (such as ResNet-50 and MobileNet-v2), support vector machine (SVM) models, and decision tree models, along with preprocessing and postprocessing logic, to any CPU, including Intel® and ARM® Cortex® processors.

Screenshot showing interactive traceability between MATLAB code and generated C/C++ code.

Integrate with Software

Reuse MATLAB algorithms as C/C++ source code or libraries within your software environment. Generated code uses C/C++ types in a natural way and can call your existing trusted C/C++ functions, simplifying integration with external code.

Screenshot of MATLAB Coder app that is verifying code for MEX functions.

Reuse MATLAB Tests on Generated Code

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 your generated C/C++ code.

Screenshot of profiling information for a generated MEX function.

Accelerate Algorithms

Call generated code as MEX functions from your MATLAB code to speed execution. Profile generated MEX functions to identify bottlenecks and focus optimization efforts.

“MATLAB and Embedded Coder enabled us to reduce the time we needed to complete the project from 24 months to 12 months—without adding more engineers to the team.”

MATLAB Coder FAQs

MATLAB Coder generates readable and portable C and C++ code from MATLAB code for deployment on various hardware platforms, from desktop systems to embedded hardware.

MATLAB Coder supports most of the MATLAB language and a wide range of toolboxes, including those for signal processing, computer vision, deep learning, and control systems.

You can integrate the generated code as source code, static libraries, dynamic libraries, or MEX functions into your existing C/C++ projects or MATLAB.

No, the generated code is royalty-free and can be deployed in commercial applications to your customers at no charge.

Yes, MATLAB Coder generates C++ classes from MATLAB value classes, handle classes, and System objects, which can be compiled into libraries or executables.

You can optimize generated code with multicore OpenMP parallelization, SIMD instructions, vectorized code, and calls to optimized libraries such as LAPACK, BLAS, and FFTW.

Yes, you can deploy trained networks like ResNet-50 and MobileNet-v2, as well as SVM and decision tree models, to any CPU including Intel and ARM Cortex-A/M processors as standalone C/C++ source code.

MATLAB Coder provides the ability to generate C/C++ code for various platforms. Embedded Coder is an add-on that extends the capabilities by providing hardware-specific optimizations, code verification using SIL/PIL testing, code traceability, and generating code that complies with MISRA.

Yes, you can reuse existing MATLAB tests and the MATLAB unit test framework to verify the behavior of your generated C/C++ code in the interactive MATLAB environment. Add MATLAB Test to create and run back-to-back equivalence tests in an automated process.

Try MATLAB Coder for Free

Discover the possibilities today.


Ready to Buy?

Get pricing information and explore related products.

Are You a Student?

Your school may already provide access to MATLAB, Simulink, and add-on products through a campus-wide license.