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:
Prepare MATLAB Function for Code Generation — Select an entry-point function and prepare it for code generation.
Automatically Define Input Types in the MATLAB Coder App — Understand why and how to specify input argument types.
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.
Configure Code Generation Settings and Generate Code — Configure code generation settings and generate code.
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.
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.