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.

Blocks

Function CallerCall Simulink or exported Stateflow function
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
FcnApply specified expression to input

Topics