MATLAB Language Features Supported for C/C++ Code Generation
MATLAB Features That Code Generation Supports
Code generation from MATLAB® code supports many major language features including:
n-dimensional arrays (see Array Size Restrictions for Code Generation)
matrix operations, including deletion of rows and columns
variable-size data (see Code Generation for Variable-Size Arrays)
subscripting (see Incompatibility with MATLAB in Matrix Indexing Operations for Code Generation)
complex numbers (see Code Generation for Complex Data)
numeric classes (see Supported Variable Types)
double-precision, single-precision, and integer math
enumerations (see Code Generation for Enumerations)
fixed-point arithmetic
program control statements
if
,switch
,for
,while
, andbreak
arithmetic, relational, and logical operators
local functions
persistent variables
global variables (see Specify Global Variable Type and Initial Value Using the App)
structures (see Structure Definition for Code Generation)
cell arrays (see Cell Arrays)
tables (see Code Generation for Tables)
timetables (see Code Generation for Timetables)
characters (see Encoding of Characters in Code Generation)
string scalars (see Code Generation for Strings)
categorical
arrays (see Code Generation for Categorical Arrays)datetime
arrays (see Code Generation for Datetime Arrays)duration
arrays (see Code Generation for Duration Arrays)sparse matrices (see Code Generation for Sparse Matrices)
function handles (see Function Handle Limitations for Code Generation)
anonymous functions (see Code Generation for Anonymous Functions)
recursive functions (see Code Generation for Recursive Functions)
nested functions (see Code Generation for Nested Functions)
variable length input and output argument lists (see Code Generation for Variable Length Argument Lists)
function argument validation (see Generate Code for arguments Block That Validates Input and Output Arguments)
subset of MATLAB toolbox functions (see Functions and Objects Supported for C/C++ Code Generation)
subset of functions and System objects in several toolboxes (see Functions and Objects Supported for C/C++ Code Generation)
function calls (see Resolution of Function Calls for Code Generation)
class aliasing
MATLAB classes (see MATLAB Classes Definition for Code Generation)
MATLAB Language Features That Code Generation Does Not Support
Code generation from MATLAB does not support the following frequently used MATLAB features (this list is not exhaustive):
scripts
GPU arrays
MATLAB Coder™ does not support GPU arrays. However, if you have GPU Coder™, you can generate CUDA® MEX code that takes GPU array inputs.
calendarDuration
arraysJava®
Map containers
time series objects
tall arrays
try
/catch
statementsimport
statementspattern
arrays