You can include System object™ code in Simulink® models with the MATLAB Function block. Your function can include one or more System objects. Portions of your system may be easier to implement in the MATLAB® environment than directly in Simulink. Many System objects have Simulink block counterparts with equivalent functionality. Before writing MATLAB code to include in a Simulink model, check for existing blocks that perform the desired operation.
You can include individual System objects that you create with a class definition file into Simulink with the MATLAB System block. This provides one way to add your own algorithm blocks into your Simulink models. For information, see System Object Integration.