フィルターのクリア

How can I generate code that uses C++ namespaces on the input/output data types?

8 ビュー (過去 30 日間)
Hendrik Deusch
Hendrik Deusch 2017 年 2 月 17 日
コメント済み: Ian Colwell 2022 年 11 月 21 日
I want to generate C++ code for a Simulink model which has several non-virtual busses as inputs and outputs. The input and output data types are defined in an external header that uses namespaces. Now if I just define a Simulink.Bus that matches the C++ structure definition, give it the same name as in C++ (but without the namespace) and set the "Header file" to the C++ Header which actually defines the structure, code generation works, BUT the generated code ignores the namespace. The name of the structure types in the generated code is solely based on the names of the Simulink.Bus objects and I obviously cannot use the namespace separator :: in the name of a Simulink.Bus. So, is there any way to have C++ namespaces in the types of input/output data? I already tried to add the namespace via a custom storage class and corresponding .tlc without any luck. As far as I understand Custom Storage Classes can only be defined for Signals(and Parameters) but not directly for Busses and when I create a Signal I have to set its data type to the respective Bus which will then again end up as struct type in the generated code.

回答 (1 件)

Pierre Harouimi
Pierre Harouimi 2021 年 5 月 11 日
  1 件のコメント
Ian Colwell
Ian Colwell 2022 年 11 月 21 日
Hi Pierre, the link you provided does not seem to apply to exporting code from simulink, it only seems to apply to exporting code from m files.
Does anyone know how to namespace simulink exported C++ code?

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

カテゴリ

Help Center および File ExchangeSimulink Coder についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by