필터 지우기
필터 지우기

Can I replace custom types during code generation?

조회 수: 1 (최근 30일)
Federico
Federico 2024년 5월 16일
답변: Poorna 2024년 5월 29일
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?

채택된 답변

Poorna
Poorna 2024년 5월 29일
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개)

제품


릴리스

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by