MATLAB: Do I get an ‘inconsistent sample time’ error when using an S-function generated from a subsystem in Simulink

conditionsimulationsimulink codersteptime

I receive an 'inconsistent sample time' error when using an S-function from a subsystem. I changed input signal sample time of original Subsystem.

Best Answer

This is the expected behavior in Real-Time Workshop. When a subsystem with a This is the expected behavior in Real-Time Workshop. When a subsystem is built using S-Function target, its sample time is hardcoded, based on the final time of the model and number of steps.
To work around this issue, you can either explicitly set the sample time, or place in a subsystem.