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:
sfunc_mdlstart_example.cpp
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:
example.cpp
#define MDL_START
static void mdlStart(SimStruct *S)
{
// This code is now executed
}Check out similar posts by category:
Matlab/Simulink
If this post helped you, please consider buying me a coffee or donating via PayPal to support research & publishing of new posts on TechOverflow