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.

For some ideas for how to use custom blocks, see Custom Block Examples.

Blocks

Fcn Apply specified expression to input
Function Caller Call Simulink or Stateflow function
Interpreted MATLAB Function Apply MATLAB function or expression to input
Level-2 MATLAB S-Function Use Level-2 MATLAB S-function in model
MATLAB Function Include MATLAB code in models that generate embeddable C code
MATLAB System Include System object in model
S-Function Include S-function in model
S-Function Builder Create S-function from C code that you provide
Simulink Function Function defined with Simulink blocks

Examples and How To

Create a Custom Block

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

Custom Block Examples

Links to additional custom block examples.

Concepts

Types of Custom Blocks

Overview of the types of custom blocks.

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?