This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

Block Creation

Create new types of blocks to extend modeling functionality using MATLAB®, C/C++, and Fortran code.

To extend the built-in modeling functionality provided by Simulink®, you can create custom blocks and add them to the Simulink Library Browser. You can create a custom block from a MATLAB function using a MATLAB Function, Fcn, or Interpreted MATLAB Function block.

MATLAB Function blocks enable you to use the MATLAB language to define custom functionality. These blocks are a good starting point if:

  • You have an existing MATLAB function that models the custom functionality.

  • You find it easier to model custom functionality using a MATLAB function than using a Simulink block diagram.

  • The custom functionality does not include continuous or discrete dynamic states.

You can also create custom blocks using several other methods, such as masking a subsystem of other blocks, or by incorporating C, C++, or Fortran code. To learn more about all block types see Create Your Own Simulink Block. To compare different types of custom blocks see Comparison of Custom Block Functionality.

  • Block Creation Basics
    Create custom blocks to extend modeling functionality
  • Block Masks
    Create customized appearance, create user–defined interface, encapsulate logic, and hide data for subsystems and custom blocks
  • Custom MATLAB Algorithms
    Create blocks that implement custom algorithms using MATLAB functions
  • Legacy Code Integration
    Integrate existing C or C++ functions, such as device drivers or external simulation code
  • Host-Specific Code
    Define custom block functionality with MATLAB, C, C++, or Fortran code
  • System Object Integration
    Define System object™ for dynamic systems, include System objects in Simulink models

Featured Examples

Was this topic helpful?