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

2 ビュー (過去 30 日間)
feng chen
feng chen 2021 年 3 月 17 日
編集済み: Harshit Desai 2021 年 3 月 18 日
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?

回答 (1 件)

Harshit Desai
Harshit Desai 2021 年 3 月 17 日
編集済み: Harshit Desai 2021 年 3 月 18 日
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 件のコメント
feng chen
feng chen 2021 年 3 月 18 日
Thank you! This seems like just the thing I need! I will test it right away

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeCode Interface Definitions についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by