matlab structure in generated code for variant control

1 visualización (últimos 30 días)
Jake Gareau
Jake Gareau el 21 de Feb. de 2024
Respondida: Aman el 15 de Mzo. de 2024
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).

Respuestas (1)

Aman
Aman el 15 de Mzo. de 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.

Productos


Versión

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by