Matlab S-Function: How to fix mdlStart() not being called
Problem
You have an S-Function in Matlab/Simulink and the mdlStart
function is not being called:
static void mdlStart(SimStruct *S)
{
// This code is never executed
}
Solution
You need to #define MDL_START
in your S-Function file before your mdlStart()
function:
#define MDL_START
static void mdlStart(SimStruct *S)
{
// This code is now executed
}