Can I replace custom types during code generation?

1 Ansicht (letzte 30 Tage)
Federico
Federico am 16 Mai 2024
Beantwortet: Poorna am 29 Mai 2024
I have a Simulink model that I use to develop my algorithm.
I am part of a larger project, other teams do not use Matlab nor Simulink.
I am using a manually defined bus that is based on a "typedef struct {} foo;" provided in a header that I can access.
To minimize complexity at the interface, I would like to use this type rather than having a separate type being defined in "<my model>_types.h".
I tried data type replacement, but that seems to work only for basic types.
Is there any way to achieve what I need?

Akzeptierte Antwort

Poorna
Poorna am 29 Mai 2024
Hi Federico,
It sounds like you're working with external code that utilizes custom struct definitions from a header file, and you're looking to streamline integration by generating code that directly uses these structs. A practical approach to achieve this in Simulink is by leveraging buses. You can modify your model so that the variables intended to match the external structs are represented using buses. These buses can be set up to ensure that the generated code aligns with your requirements.
Please refer to the following documentation. It has the step by step information on generating code that matches the external data types:
Hope this Helps!

Weitere Antworten (0)

Kategorien

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

Produkte


Version

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by