Main Content

Block Creation Basics

Principles of extending block functionality of Simulink® through new block development

Simulink allows you to extend the built-in modeling functionality by integrating existing code and creating your own blocks.

Existing code can be any code that provides the kind of functionality not available through Simulink library blocks. You can integrate MATLAB®, C/C++, and Fortran code. You can also integrate System object™.

Create a new Simulink block for your needs if the built-in library does not provide a suitable block. You can create new functionality using a MATLAB function rather than a Simulink block diagram.


Function CallerCall Simulink or exported Stateflow function
Interpreted MATLAB FunctionApply 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
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


Types of Custom Blocks

Learn about the capabilities of custom blocks.

Design and Create a Custom Block

Build a custom block using a Level-2 MATLAB S-function.

Comparison of Custom Block Functionality

Compare and contrast the features of different custom blocks types.