Include a printf in compiled simulink blocks

16 vues (au cours des 30 derniers jours)
Claudio
Claudio le 20 Avr 2012
Dear all, I'm compiling my Simulink model in order to have an executable files. It works flawlessly but I would like to include a printf of some Simulink variables, in order to see their values at run-time. Something like adding
printf("\rx: %f, y: %f, z: %f", x, y, z);
In other words, I would like to see:
$ ./test x: 0.4812, y: 0.2323, z: 0.78321
being x,y,z variables I have in my Simulink model.
Thank you very much for your help.

Réponses (1)

Kaustubha Govind
Kaustubha Govind le 20 Avr 2012
Which blocks do these signals correspond to? If they are S-function blocks that you have written, you can put the printf commands in the corresponding TLC file. Beyond that, you might need to use advanced Simulink Coder concepts depending on what kind of target you are generating and whether the signals are outputs of specific blocks/subsystems. If you only need to do this for debugging, I would recommend just putting in the printf commands manually into the generating code.
Note: What you're asking for is not supported on a generic embedded system and therefore is not part of the core Simulink/Embedded Coder features. Note that an stdout is not even present on a lot of embedded systems.

Catégories

En savoir plus sur Simulink Coder dans Help Center et File Exchange

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by