MATLAB: Do I receive an error about invalid sample time when implementing an inherited, fixed-in-minor-step sample time for a Level-2 MATLAB S-Function in Simulink 7.7 (R2011a)

simulink

I have implemented a simple Level-2 MATLAB S-Function with an inherited, fixed-in-minor-step sample time:
block.SampleTimes = [-1 1];
When running this application I receive an error about an invalid sample time:
Sample time [-1, 1] of 'test/MATLAB file (level-2) S-Function' is invalid.

Best Answer

An inherited and fixed-in-minor-step sample time is invalid for Level-2 MATLAB S-Functions. For a list of valid sample time, offset pairs please refer to the documentation under the following link:
To workaround this issue you can implement the IsMajorTimeStep() method in the Output() or Update() methods of the Level-2 MATLAB S-Function to determine whether the current simulation time step is a major time step.