Specify parameters to be PrivateGlobals in Simulink Coder

3 Ansichten (letzte 30 Tage)
Shamoil
Shamoil am 1 Nov. 2023
Beantwortet: Altaïr am 3 Feb. 2025
How do you specify specific parameters to be PrivateGlobals in Simulink Coder?
There is an option to set all block outputs as global variables in Code Generation>Optimisation>Opt Levels but it does not mention how we can only specify a select few block outputs as globals.
Thanks

Antworten (1)

Altaïr
Altaïr am 3 Feb. 2025
The Code Mappings pane is a useful tool for adjusting the storage class of Simulink signals. If it isn't visible, it can be accessed by selecting Code Interface > Individual Element Code Mappings from the C CODE tab in Simulink Coder.
To make specific block outputs global in the generated code, follow these steps:
1. Go to the Signals/States tab in the Code Mappings pane.
2. Select the output signal whose storage class needs modification and click the Add selected signals to code mappings, icon.
3. Change the storage class of the signal to ExportedGlobal.
4. Click the icon on the right and edit the identifier name to the desired value, which will be the signal's name in the generated code.
After these steps, click Build to generate the code. The global signal can be viewed in the generated code using the report.
For more information on Code Mappings, please refer to this page:

Kategorien

Mehr zu Audio I/O and Waveform Generation finden Sie in Help Center und File Exchange

Produkte


Version

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by