Borrar filtros
Borrar filtros

Unit Delay Initialization C Code Generation

13 visualizaciones (últimos 30 días)
Jack
Jack el 14 de Mzo. de 2024
Movida: Fangjun Jiang el 28 de Mzo. de 2024
I have a model in which I am generating C code for. This model has a Unit Delay block in with an intial condition set to 0. When I generate the C code, where the intialization step would usually occur for a non zero Initial condition, No code is generated but I assume somewhere it must be intialising this variable. Where is this done instead and why does it change.
Thanks

Respuestas (1)

Fangjun Jiang
Fangjun Jiang el 18 de Mzo. de 2024
Movida: Fangjun Jiang el 28 de Mzo. de 2024
You could experiment. Set the initial value to be zero and non-zero to see where the code is located. Note that in C code, the initial value for a variable is zero by default. Or it can be initialized when the variable is declared, such as
int myNum = 15;
  8 comentarios
Fangjun Jiang
Fangjun Jiang el 18 de Mzo. de 2024
Movida: Fangjun Jiang el 28 de Mzo. de 2024
no. There should be a generated C code variable that corresponds to the output of the Unit Delay block. Search the declaration of that variable in the C code. You can turn on traceability to help find it.
Jack
Jack el 18 de Mzo. de 2024
Movida: Fangjun Jiang el 28 de Mzo. de 2024
Okay my mistake. I have tried the tracebility tool but it doesn't seem to help.

Iniciar sesión para comentar.

Categorías

Más información sobre Simulink Coder en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by