Main Content

User-Defined Functions

Custom function blocks such as MATLAB Function, MATLAB System, Simulink Function, and Initialize Function

Use blocks from the User-Defined Functions library to extend Simulink® modeling functionality by creating new types of blocks. You can implement block algorithms using MATLAB®, C/C++, and Fortran® code.

Blocs

C CallerIntegrate C code in Simulink
C FunctionIntegrate and call external C/C++ code from a Simulink model
FcnApply specified expression to input
Function CallerCall Simulink or exported Stateflow function
Initialize FunctionExecute subsystem on model initialize event
Interpreted MATLAB Function(To be removed) Apply MATLAB function or expression to input
Level-2 MATLAB S-FunctionUse Level-2 MATLAB S-function in model
MATLAB FunctionInclude MATLAB code in models that generate embeddable C code
MATLAB SystemInclude System object in model
Reinitialize FunctionExecute subsystem on model or subsystem reinitialize event
Reset FunctionExecute subsystem on model reset event
S-FunctionInclude S-function in model
S-Function BuilderIntegrate C or C++ code to create S-functions
Simulink FunctionGraphically define a function with Simulink blocks
Terminate FunctionExecute subsystem on model terminate event