Code generation from MATLAB® code supports the following language features:
n-dimensional arrays (see Array Size Restrictions for Code Generation)
matrix operations, including deletion of rows and columns
variable-sized data (see Variable-Size Data Definition for Code Generation)
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
fixed-point arithmetic
program control statements if
, switch
, for
, while
,
and break
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)
characters (see Code Generation for Character Arrays)
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)
variable length input and output argument lists
subset of MATLAB toolbox functions (see Functions and Objects Supported for C/C++ Code Generation — Alphabetical List)
subset of functions and System objects in Aerospace Toolbox, Audio System Toolbox™, Communications System Toolbox™, Computer Vision System Toolbox™, DSP System Toolbox™, Fixed-Point Designer™, Image Processing Toolbox™, Phased Array System Toolbox™, Robotics System Toolbox™, Signal Processing Toolbox™, Statistics and Machine Learning Toolbox™, System Identification Toolbox™, Wavelet Toolbox™, WLAN System Toolbox™ (see Functions and Objects Supported for C/C++ Code Generation — Category List)
MATLAB classes (see MATLAB Classes Definition for Code Generation)
function calls (see Resolution of Function Calls for Code Generation)
Code generation from MATLAB does not support the following frequently used MATLAB constructs:
string arrays
categorical arrays
date and time arrays
Java®
Map containers
nested functions
sparse matrices
tables
time series objects
try
/catch
statements
This list is not exhaustive. To see if a construct is supported for code generation, see MATLAB Features That Code Generation Supports.