INFO:
Explicitly schedule the execution of your model components, including Export Functions and rate-based models, with Schedule Editor for both simulation and code generation, where every specified partition has an entry point in the generated code.
How to Use Schedule Editor - MATLAB & Simulink