- Open unit delay block and set the initial condition with name lets say "myParam" and its value to be "Simulink.Parameter(100)”. Click OK.
- On the Code Generation tab, click the Code Mappings editor, set Storage Class of "myParam" to "Define". Click OK.
- To build the model and generate code, press Ctrl+B.
MACRO Expansion in Targetlink Code
4 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Sulagna
am 24 Aug. 2023
Kommentiert: Champuram Madhu
am 3 Okt. 2023
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.
0 Kommentare
Akzeptierte Antwort
Varun
am 28 Aug. 2023
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:
You can refer this documentation for more info: https://in.mathworks.com/help/ecoder/ug/macro-definitions-define.html
3 Kommentare
Champuram Madhu
am 3 Okt. 2023
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
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Simulink Coder finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!