MATLAB Coder

Generating Code from MATLAB

Translating MATLAB algorithms to C code involves specifying implementation requirements. MATLAB Coder guides you through this iterative process while enabling you to stay within the MATLAB language. You ensure that your algorithm is compliant for code generation by generating a MEX function that wraps the compiled code for execution back within MATLAB. MATLAB Coder produces a report that identifies any errors which must be fixed to make your MATLAB algorithm compliant for code generation. You iterate between fixing errors and regenerating a MEX function until your MATLAB algorithm is suitable for code generation.

You can now generate either C or C++ source code or a MEX function tuned for performance from your MATLAB algorithm.

C or C++ source code enables you to:

  • Prototype on PCs
  • Create a library
  • Implement as embedded code

The MEX function can be called in place of the original MATLAB code to:

  • Verify the compiled code back in MATLAB
  • Accelerate the execution
Three-step iterative workflow for generating code from MATLAB using  MATLAB Coder.
Three-step iterative workflow for generating code from MATLAB using MATLAB Coder.
Next: MATLAB Coder with Simulink Coder and Embedded Coder

Try MATLAB Coder

Get trial software

Free Quick Start Guide

View Guide