How to generate code with multiple keywords?

1 Ansicht (letzte 30 Tage)
Sourabh
Sourabh am 8 Sep. 2022
Beantwortet: arushi am 19 Aug. 2024
I need to generate code with multiple keywords such as extern volatile var1 in the declaration. The different options such as importedExtern and Volatile in the 'Code Interface ->Default Code Mappings -> Data Stores ->Storage Class' generate extern and volatile respectively but not together. How do I generate code with several keywords in the declaration?

Antworten (1)

arushi
arushi am 19 Aug. 2024
Hi Sourabh,
I understand that you want to generate code with several keywords in the declaration.
To generate code with multiple keywords in the declaration of a variable, you can use a custom storage class definition in Simulink. Here's how you can achieve this:
  1. Navigate to "Simulation" > "Model Configuration Parameters" in the menu.
  2. In the "Model Configuration Parameters" window, navigate to the "Code Generation" section.
  3. Under the "Code Generation" section, you will find various settings related to code generation, including options for customizing the generated code.
  4. Navigate to "Default Code Mappings" and select "Data Stores".
  5. Under "Storage Class", select "Custom Storage Class" from the drop-down menu.
  6. In the "Custom Storage Class" field, enter the desired keywords separated by spaces. For example, you can enter extern volatile.
  7. Click "Apply" or "OK" to save the changes.
By specifying multiple keywords separated by spaces in the "Custom Storage Class" field, you can generate code with several keywords in the variable declaration. In this case, it will generate code with both extern and volatile keywords in the declaration.
You can refer to the below documentation to know more about the Model Configuration Parameters:
Hope this helps.

Kategorien

Mehr zu Deployment, Integration, and Supported Hardware finden Sie in Help Center und File Exchange

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by