Main Content

Deployment Basics

Understand the basic workflows and requirements to deploy generated code

Binaries and executables can be created from the app, or from the command line. Generate deployable code with an example main function to incorporate the executable or binary into your application. Supporting initialization and cleanup functions are also generated for your use. Depending on the types of arrays you want to integrate into your packaged code, see the relevant pages below.


coder.cevalCall external C/C++ function
coder.cincludeInclude header file in generated code
packNGoPackage generated code in ZIP file for relocation


coder.HardwareImplementationHardware-specific configuration parameters for C/C++ code generation from MATLAB code
coder.hardwareCreate hardware board configuration object for C/C++ code generation from MATLAB code


Deployment Basics

Deploy Generated Code

Fundamental considerations for creating working binaries from generated code.

Approaches for Building Code Generated from MATLAB Code

Choose CMake or toolchain approach for building generated code.

Generating Standalone C/C++ Executables from MATLAB Code

Generate C/C++ executables at the command line or in the MATLAB® Coder™ app.

Example Main

Incorporate Generated Code Using an Example Main Function

MATLAB Coder generates an example main function that helps you to incorporate generated C code into your application.

Structure of Generated Example C/C++ Main Function

Examine the parts of a generated example main function so that you can modify an example main for your application.

Using Generated Code

Use Generated Initialize and Terminate Functions

Use supporting functions to perform initialization and cleanup operations.

Use C Arrays in the Generated Function Interfaces

Understand and use arrays from the generated function interfaces

Use Dynamically Allocated C++ Arrays in Generated Function Interfaces

Understand and use dynamically allocated arrays from the generated C++ function interfaces.

Package Code for Other Development Environments

Package generated files into a compressed file that you can relocate and unpack with a standard zip utility.

Featured Examples