S Mex function global variable values

3 visualizaciones (últimos 30 días)
Lila Lotus
Lila Lotus el 15 de Jul. de 2020
Respondida: Lila Lotus el 16 de Jul. de 2020
Hello,
I have legacy C code with many global variables, which is bound into simulink be means of Mex-S-function.
When I stop and restart simulation I would expectd that new process is created and all those variables are to there init value (most of them 0, because not explicitely set and so on).
If I just start and stop and start it is unfortunately not the case.
If I start, stop, then rebuild S-function by "mex" command and then start it is the case.
Is there any way to say Simulink to unload the process on each simulation stop/end (I mean stop, not pause of course)?
Thanks,
  4 comentarios
James Tursa
James Tursa el 16 de Jul. de 2020
Editada: James Tursa el 16 de Jul. de 2020
Does the mex function itself show up in the list generated by the inmem( ) function? E.g.,
[M,X] = inmem;
Does it show up in the X list?
Paresh yeole
Paresh yeole el 16 de Jul. de 2020
Use
clear all
everytime you run a simulation.
But this is not optimal as many others would suggest.

Iniciar sesión para comentar.

Respuestas (1)

Lila Lotus
Lila Lotus el 16 de Jul. de 2020
Thank you, clear mex did the job

Categorías

Más información sobre Event Functions en Help Center y File Exchange.

Productos

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by