Documentation

Block Creation Basics

Create custom blocks to extend modeling functionality

Custom blocks expand the modeling functionality provided with Simulink®. Use a custom block to:

  • Model behaviors that are not provided with a Simulink built-in solution.

  • Build more advanced models.

  • Encapsulate model components into a library block that you can copy into multiple models.

  • Provide custom user interfaces or analysis routines.

Blocks

FcnApply specified expression to input
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 BuilderCreate S-function from C code that you provide
Simulink FunctionFunction defined with Simulink blocks

Examples and How To

Create a Custom Block

Step-by-step example of building a custom block.

Concepts

Create Your Own Simulink Block

Create custom blocks for Simulink.

Comparison of Custom Block Functionality

List of features provided by different custom blocks types.

Expanding Custom Block Functionality

How to use callbacks and MATLAB® graphics to add functionality to custom blocks.

Was this topic helpful?