MATLAB: Do I get an error while using a Fortran Level-1 S-function inside a triggered subsystem in Simulink 7.4 (R2009b)

simulink

I have a Simulink model named 'Mathworks_Test_DoesNotWork.mdl' that contains a Fortran Level-1 S-function inside a triggered subsystem. When I simulate the model, it produces the following error message:
'Mathworks_Test_DoesNotWork/Triggered Subsystem/S-Function' has a continuous sample time. Only constant (inf) or inherited (-1) sample times are allowed in triggered subsystem 'Mathworks_Test_DoesNotWork/Triggered Subsystem'.

Best Answer

This is expected behavior. This issue occurs because triggered subsystems do not support continuous sample times, but Fortran Level-1 S-functions support only continuous sample times. Therefore Fortran Level-1 S-functions can not be included inside a triggered subsystem.
There are two ways to work around this issue:
1. Use Level-2 S-functions instead of Level-1 S-functions as explained in the following documentation page:
<http://www.mathworks.com/access/helpdesk/help/toolbox/simulink/sfg/f5-88442.html>
2. Use enabled subsystems in place of triggered subsystems. This is demonstrated in the attached model "Mathworks_Test_Works.mdl"