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.