How to set the scope of C + + code generated by datastore module to public?

2 vues (au cours des 30 derniers jours)
feng chen
feng chen le 17 Mar 2021
Modifié(e) : Harshit Desai le 18 Mar 2021
By default, the scope of the variables generated by the datastore module is private. how can I modify the model to make the scope of the generated variables to public?

Réponses (1)

Harshit Desai
Harshit Desai le 17 Mar 2021
Modifié(e) : Harshit Desai le 18 Mar 2021
I understand that you are trying to make the data store module scope public in the generated code and I am assuming you are using R2020b or before.
Until MATLAB R2020b, the code mapping for Target language C++ was not supported.
But from MATLAB 2021a, MathWorks product Embedded Coder is supporting Code mapping for C++. So if you like you can upgrade to R2021a. But if upgrading isnt an option, then this limitation would exist.
But if you do upgrade then :
This tool lets you customize the generated code by changing the data visibility and member access functions.
You can find more Information on this MathWorks documentation page --> https://www.mathworks.com/help///ecoder/ref/codemappingsceditor.html
To Answer your question.
You can change the scope of the variables by opening the code mappings pane by
  1. clicking on 3 dots on the bottom right on the simulink canvas or
  2. From the tool strip click on Code Interface --> code mappings
Then you can select in the Data Tab --> Signals, state and internal data and change the visibility to public.
  1 commentaire
feng chen
feng chen le 18 Mar 2021
Thank you! This seems like just the thing I need! I will test it right away

Connectez-vous pour commenter.

Catégories

En savoir plus sur Code Interface Definitions 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!

Translated by