This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

When to Generate Code from MATLAB Algorithms

Generating code from MATLAB® algorithms for desktop and embedded systems allows you to perform your software design, implementation, and testing completely within the MATLAB workspace. You can:

  • Verify that your algorithms are suitable for code generation

  • Generate efficient, readable, and compact C/C++ code automatically, which eliminates the need to manually translate your MATLAB algorithms and minimizes the risk of introducing errors in the code.

  • Modify your design in MATLAB code to take into account the specific requirements of desktop and embedded applications, such as data type management, memory use, and speed.

  • Test the generated code and easily verify that your modified algorithms are functionally equivalent to your original MATLAB algorithms.

  • Generate MEX functions to:

    • Accelerate MATLAB algorithms in certain applications.

    • Speed up fixed-point MATLAB code.

  • Generate hardware description language (HDL) from MATLAB code.

When Not to Generate Code from MATLAB Algorithms

Do not generate code from MATLAB algorithms for the following applications. Use the recommended MathWorks® product instead.

Deploy an application that uses handle graphicsMATLAB Compiler™
Use Java®MATLAB Compiler SDK™
Use toolbox functions that do not support code generationToolbox functions that you rewrite for desktop and embedded applications
Deploy MATLAB based GUI applications on a supported MATLAB hostMATLAB Compiler
Deploy web-based or Windows® applications


Interface C code with MATLAB

MATLAB mex function

Was this topic helpful?