Main Content

Simulink Functions

Create functions accessible in Simulink models

A Simulink® function is a computational unit that calculates a set of outputs when provided with a set of inputs. Since a Simulink function provides a common text interface to its function definition and a function caller, how you define the function is your choice. Possible function definitions include using:

  • Simulink blocks in a Simulink Function block

  • Stateflow® state transitions in an exported Stateflow graphical function

  • MATLAB® code statements in an exported Stateflow MATLAB function

After you define a function, you can call it using a Function Caller block, a MATLAB Function block, or a Stateflow chart.


expand all

Simulink FunctionGraphically define a function with Simulink blocks
ChartImplement control logic with finite state machine
Function CallerCall Simulink or exported Stateflow function
MATLAB FunctionInclude MATLAB code in Simulink models
ChartImplement control logic with finite state machine
InportCreate input port for subsystem or external input
OutportCreate output port for subsystem or external output
Function ElementSpecify function to be called via exporting function port (Since R2022a)
Function Element CallSpecify function call to be issued via invoking function port (Since R2022a)


Understanding Simulink Functions

Scoped Simulink Functions

Client-Server Interfaces in Simulink