Except for ODE1, the fixed-step continuous solvers use multiple minor time steps to solve the differential equations for the major time steps. If you want an Embedded MATLAB Block to only run at the major time steps you can set the Sample Time accordingly in the Ports and Data Manager:
- Open the Embedded MATLAB Editor for the block you want to run on the major time steps
- Choose Tools -> Edit Data/Ports
- Set the update method to "Discrete" and specify the Sample Time as the Sample Time of the Simulink model.
You may want to create a variable in the Workspace to set both the Sample Time of the block and the model at the same time.
Best Answer