Main Content

MATLAB Function Block Basics

Integrate MATLAB® functions into Simulink® models

Use MATLAB Function blocks to implement MATLAB functions in Simulink models. Using MATLAB Function blocks, you can generate readable, efficient, and compact C/C++ code for deployment to desktop and embedded applications.


MATLAB Function Block EditorCreate, edit, and debug MATLAB code in MATLAB Function blocks


MATLAB FunctionInclude MATLAB code in models that generate embeddable C code


MATLABFunctionConfigurationMATLAB Function block property configuration
Stateflow.EMChartStateflow interface to MATLAB Function block



Debug MATLAB Function Blocks

Debug MATLAB Function block code during simulation.

Prevent Algebraic Loop Errors in MATLAB Function, Chart, and Truth Table Blocks

Adhere to restrictions for using MATLAB Function blocks, Chart, and Truth Table blocks in feedback loops.

Initialize Persistent Variables in MATLAB Functions

Specialized semantics impact the way that a function initializes persistent data.