I am running a Simulink model which contains a C-MEX or FORTRAN S-function which uses persistent, static and/or global variables. When I run repeated (identical) simulation runs, I receive varying results due to S-function/C-code static variables not being re-initialized properly (except for the first time) by MATLAB and Simulink.
MATLAB: Are static variables in C or FORTRAN MEX S-functions not reset when running successive simulations
simulink
Related Question
- Speed comparison S-Function – Simulink blocks
- Is it possible to force the S-Function block to initialize completely before the other blocks during the course of a simulation in Simulink 7.3(R2009a)
- MEXファイルで初期化ルーチンを実行するには、どのようにCコードを書けば良いですか?
- Do I receive a calling convention error when calling a Fortran function from a C S-Function with Simulink
Best Answer