Simulink Code Generator - Preserve User Names
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Using Version 2018b, is there a way to use the "Preserve User Names" for "code" in a MATLAB function (as the help indicates is in the MATLAB encoder for code generation)?
Looking at the code generated out of the Simulink Code generation, I can see that it makes decisions on removing locally declared variables. These have been added to avoid repeating calculations throughout the script therefore reducing the number of function calls required. However, when these are optimised in code generation, the labels are used in a different order meaning the code is now misleading . Now this could be fixed by not using meaningful names in the Matlab function script in the first place, but that's not acceptable really. When I have to debug this code, I want to be able to read it as intended.
0 commentaires
Réponses (1)
Meghna Chatterjee
le 14 Avr 2021
Hi Simon,
To control the names of the structures in the generated code, you need an Embedded Coder® license. To instead store a data item in a separate global variable whose name, file placement, and other characteristics you can control, you can apply a storage class to a signal, state, or Simulink.Parameter object. See C Code Generation Configuration for Model Interface Elements and Configuring Data Accessibility for additional explanation and steps.
Voir également
Catégories
En savoir plus sur Simulink Coder dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!