Clear Filters
Clear Filters

matlab structure in generated code for variant control

4 views (last 30 days)
is there anyway to control how a matlab structure is generated with embedded coder? for example setting the storage class or name? currently the structure has a random name and only appears if I have parameters set to tunable, it is also nested inside another data structure.
I want to use the structure to control a variant subsystem. Trying to use a simulink.parameter with a bus data type does not work for embedded coder codegen (startup activation).

Answers (1)

Aman
Aman on 15 Mar 2024
Hi Jake,
From the information provided, I understand that you want to have control over the name and the storage class in the generated code.
In order to give a custom name to the structure in the generated code, you can use the "coder.cstructname" function, which names the C structure type in the generated code. It can also be used to give a name to the nested structure that is your desired requirement. You can refer to the following documentation link, which discusses the same.
In order to control the storage class in the generated code, you can utilize the "CoderInfo" property of the "Simulink.Parameter" object and the "CustomStorageClass" property of the "CoderInfo" to set the custom storage class. You can refer to the following documentation to learn more about it.
I hope this will help you proceed with your workflow.

Categories

Find more on Deployment, Integration, and Supported Hardware in Help Center and File Exchange

Products


Release

R2023a

Community Treasure Hunt

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

Start Hunting!