Include a printf in compiled simulink blocks

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.

답변 (1개)

Kaustubha Govind
Kaustubha Govind 2012년 4월 20일

0 개 추천

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.

카테고리

도움말 센터File Exchange에서 Simulink Coder에 대해 자세히 알아보기

제품

태그

질문:

2012년 4월 20일

Community Treasure Hunt

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

Start Hunting!

Translated by