Is there a way to define the name of generated C++ classes when using Simulink Coder with an slrealtime target?

2 ビュー (過去 30 日間)
Tom Goring
Tom Goring 2022 年 11 月 23 日
回答済み: Harsh 2025 年 1 月 2 日
When I generate C++ code for a model normally (lets called it "testcoder") - the generated C++ classes and files are named using the model name, e.g. 'testcoder.h', 'testcoder_M' etc. Is there a way to override this? For context, I want to write a C++ wrapper that can be applied to arbitrary slrealtime models with a small MATLAB script, but currently the C++ will break as there are references to hardcoded file names (e.g. #include "testcoder.h" and accessing the MMI of the main model class - testcoder_M).

回答 (1 件)

Harsh
Harsh 2025 年 1 月 2 日
Hi Tom,
You can change the name of the files and classes in a limited manner only. Please follow the below steps to do so -
  • On the Code Generation > Code Placement pane, select File packaging format as Compact(with separate date file).
  • Specify custom file names here.
Please refer to the following MathWorks documentation for more information regarding this - https://www.mathworks.com/help/releases/R2022a/ecoder/ug/customize-generated-file-names.html

カテゴリ

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

製品


リリース

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by