Products & Services Solutions Academia Support User Community Company

Learn more about Simulink   

mdlStart - Initialize the state vectors of this S-function

Required

No

C Syntax

#define MDL_START
void mdlStart(SimStruct *S)

C Arguments

S

SimStruct representing an S-Function block.

M Syntax

Start(s)

M Arguments

s

Instance of Simulink.MSFcnRunTimeBlock class representing the Level-2 M-File S-Function block.

Description

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.

Languages

C, C++, M

C Example

See matlabroot/toolbox/simulink/simdemos/simfeatures/src/sfun_directlook.c for an example of how to use this function.

M Example

See matlabroot/toolbox/simulink/simdemos/simfeatures/msfcn_varpulse.m for an example of how to use this function.

See Also

mdlInitializeConditions, ssGetContStates, ssGetDiscStates

  


Related Products & Applications

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