Why do comments for Simulink.Signal object not show up in generated code when using Embedded Coder?

3 visualizaciones (últimos 30 días)
I've included some text in the description field for some of MPT.Signal objects in my model and I'm expecting to see the text as comments in the generated code. I have checked the 'Include Comments' option as well as the 'Simulink Data Object Descriptions' option in the model's config params. Further, these signal objects have also been associated with signals in the model. However, I do not see comments for all such Signal objects.
Why does this happen?

Respuesta aceptada

MathWorks Support Team
MathWorks Support Team el 21 de Jun. de 2019
Please verify the storage class of the MPT.Signal object you have defined and check if it is set to 'Auto'. When the storage class of a signal is set to Auto, you're essentially providing Embedded Coder with the option of optimizing out the signal should it be deemed more efficient to do so. In your case, it is possible that Embedded Coder is optimizing out the Signal object and therefore, doesn't generate the comment.
I would suggest changing the the storage class of the signal from 'Auto' to something like 'ExportedGlobal' to ensure the appearance of this variable in the generated code, and by extension, a comment. However, please note that setting 'ExportedGlobal' as the storage class is merely a suggestion. You are encouraged to identify a storage class that is more suitable to your workflow that and add that setting to the signal. It is just that the 'Auto' storage class could result in the signal being optimized out.

Más respuestas (0)

Productos


Versión

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by