フィルターのクリア

MACRO Expansion in Targetlink Code

12 ビュー (過去 30 日間)
Sulagna
Sulagna 2023 年 8 月 24 日
コメント済み: Champuram Madhu 2023 年 10 月 3 日
I am trying to use a unit delay block where the initial condition of delay block is a macro, In the production code of Targetlink the Macro is automatically expanded to the value, i dont want that macro to expand in generated code. The block is inside a Lib file, so the entire code is not generated, only initial values are generated in main code.

採用された回答

Varun
Varun 2023 年 8 月 28 日
Hi Sulagana,
I understand the issue that the macro used to set initial condition of delay block is being expanded in the generated code.
In order to used it as a macro only without being expanded, you can follow below steps:
  1. Open unit delay block and set the initial condition with name lets say "myParam" and its value to be "Simulink.Parameter(100)”. Click OK.
  2. On the Code Generation tab, click the Code Mappings editor, set Storage Class of "myParam" to "Define". Click OK.
  3. To build the model and generate code, press Ctrl+B.
You can refer this documentation for more info: https://in.mathworks.com/help/ecoder/ug/macro-definitions-define.html
  3 件のコメント
Sulagna
Sulagna 2023 年 8 月 29 日
Is it possible using TargetLink as well?
Champuram Madhu
Champuram Madhu 2023 年 10 月 3 日
Hi
You could try creating a TargetLink DD variable with MACRO class.
In that case, it should be generated as a MACRO irrespective of the location

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

その他の回答 (0 件)

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by