Skip to Main Content Skip to Search
Product Documentation

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.

MATLAB Syntax

Start(s)

MATLAB Arguments

s

Instance of Simulink.MSFcnRunTimeBlock class representing the Level-2 MATLAB 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++, MATLAB

C Example

See sfun_directlook.c for an example of how to use this function.

MATLAB Example

See 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-2012- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS