Hi Jerome,
One way to achieve this is to use the “ssRTWGenIsCodeGen” function. This function detects whether the S-Function is being used for standalone code generation.
You can modify your mdlStart() function to check whether it is being executed during code generation or during normal execution. This can be done by using the “ssRTWGenIsCodeGen” function, which returns true if the model is being compiled for code generation.