Contents

mdlStart

Initialize the state vectors of this C MEX S-function

Required

No

Languages

C, C++

Syntax

#define MDL_START
void mdlStart(SimStruct *S)

Arguments

S

SimStruct representing an 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.

Example

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

Was this topic helpful?