Hauptinhalt

Generate Deployable Standalone Code by Using the MATLAB Coder App

You can use MATLAB® Coder™ to generate C and C++ code from your MATLAB code. You can:

  • Generate standalone C and C++ code to use in your projects as source code, static libraries, or dynamic libraries.

  • Generate standalone C or C++ executables.

  • Generate MEX functions to accelerate computation-intensive operations in MATLAB.

This tutorial shows how to use the MATLAB Coder app to generate standalone C++ code from a MATLAB function. If you are familiar with C or C++ and static variable typing, you can follow an abbreviated version of this tutorial that uses command-line tools to generate code. See Generate Standalone C Static Library at the Command Line.

In this tutorial, you follow these steps to generate and deploy code for a MATLAB function by using the MATLAB Coder app:

  1. Prepare MATLAB Function for Code Generation — Select an entry-point function and prepare it for code generation.

  2. Automatically Define Input Types in the MATLAB Coder App — Understand why and how to specify input argument types.

  3. Check for Code Generation Issues by Generating and Running a MEX Function — Check for issues in your MATLAB code by generating and running a MEX function.

  4. Configure Code Generation Settings and Generate Code — Configure code generation settings and generate code.

  5. Verify Generated Code by Using SIL or PIL — If you have Embedded Coder®, you can verify the generated code by using software-in-the-loop (SIL) or processor-in-the-loop (PIL) execution.

  6. Optimize and Deploy Generated Code — Learn about options for the optimization and deployment of the generated code.

To start the tutorial, see Prepare MATLAB Function for Code Generation.

See Also

Apps

Functions

Topics