I have a C-MEX S-function that contains numerous global variables. After compiling the S-function in question, I instantiate two copies of it in a Simulink model. Each instantiation (block) receives the same input signal, but a different set of parameters are passed to each instance of the S-function. When I run the model, I expect to see different outputs, but I see the same output from both blocks. Why is this the case?
MATLAB: How does a C-MEX S-function manage its memory when there are multiple instances of it in a model
globalinputinstancesmultiples-functionsamesignalsimulinkvariables
Best Answer