| Products & Services | Solutions | Academia | Support | User Community | Company |
| Download Product Updates | | | Get Pricing | | | Trial Software |
| Documentation → Simulink |
| Contents | Index |
| Learn more about Simulink |
No
#define MDL_START
void mdlStart(SimStruct *S)
Start(s)
Instance of Simulink.MSFcnRunTimeBlock class representing the Level-2 M-File S-Function block.
The Simulink engine invokes this optional method at the beginning of a simulation. The method performs initialization activities that this S-function requires only once, such as allocating memory, setting up user data, or initializing states.
If your S-function resides in an enabled subsystem and needs to reinitialize its states every whenever the subsystem is enabled, use mdlInitializeConditions to initialize the state values, instead of mdlStart.
In C MEX S-functions, use ssGetContStates and/or ssGetDiscStates to get the states.
C, C++, M
See matlabroot/toolbox/simulink/simdemos/simfeatures/src/sfun_directlook.c for an example of how to use this function.
See matlabroot/toolbox/simulink/simdemos/simfeatures/msfcn_varpulse.m for an example of how to use this function.
mdlInitializeConditions, ssGetContStates, ssGetDiscStates
![]() | mdlSimStatusChange | mdlTerminate | ![]() |

Learn more about Simulink through this collection of videos, articles, technical literature and the Getting Started with Simulink Guide.
| © 1984-2009- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |