Matlab S-Function:如何修复 mdlStart() 未被调用
问题
你在 Matlab/Simulink 中有 S-Function,但 mdlStart 函数未被调用:
sfunc_mdlstart_example.cpp
static void mdlStart(SimStruct *S)
{
// This code is never executed
}解决方案
你需要在 S-Function 文件中的 mdlStart() 函数之前 #define MDL_START:
mdlstart_fix.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