Borrar filtros
Borrar filtros

Info

La pregunta está cerrada. Vuélvala a abrir para editarla o responderla.

How can I compile (C) variables used several time in Simulink as global?

1 visualización (últimos 30 días)
Silvia
Silvia el 12 de Jun. de 2014
Cerrada: MATLAB Answer Bot el 20 de Ag. de 2021
Hallo,
I have a Simulink model in which I use some parameters in different places. I initialize each parameter at the beginning through a .m file, where they are all listed. Than I call them through "costants" blocks every time I need them.
Now, when I generate the C code, a new variable is actually defined and declared every time I use the same constant in Simulink. How can I compile, so that each different parameter is only once as global defined in the C code?
Thank you very much!
  1 comentario
Kaustubha Govind
Kaustubha Govind el 13 de Jun. de 2014
Do you mean that multiple C variables are created for each MATLAB variable? I would expect a 1:1 correspondence. Could you clarify?

Respuestas (1)

Anthony Poulin
Anthony Poulin el 3 de Jul. de 2014
Do you try to use "Goto" and "From" simulink blocks?
You declare your variables in constant blocks once and you connect them to Go to blocks.
Then, instead of use constant block when you need the varaiable, you use a From block like in the picture below.

La pregunta está cerrada.

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by