Writing S-Functions    

Checking Array Bounds

If your S-function causes otherwise inexplicable errors, the reason might be that the S-function is writing beyond its assigned areas in memory. You can verify this possibility by enabling Simulink's array bounds checking feature. This feature detects any attempt by an S-Function block to write beyond the areas assigned to it for the following types of block data:

To enable array bounds checking, select warning or error from the Bounds checking options list on the Simulation Parameters dialog box or enter the following command at the MATLAB command line.


  ssSetErrorStatus Termination Criteria S-Function Examples