Can I replace custom types during code generation?
3 views (last 30 days)
Show older comments
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?
0 Comments
Accepted Answer
Poorna
on 29 May 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!
0 Comments
More Answers (0)
See Also
Categories
Find more on Deployment, Integration, and Supported Hardware in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!