필터 지우기
필터 지우기

How to create union in simulink

조회 수: 8 (최근 30일)
WJKIM
WJKIM 2024년 5월 8일
댓글: Meghna 2024년 7월 16일 23:51
Hellow.
I have a question about how to union in simulink in simulink coder.
I know how to create the bus of struct using the 'Simulink bus' in dictionary file. (*.sldd)
However, i can't see the part that creates the union.
Does Mathoworks support the method of generating code an union as shown below?
If so, could you tell me how?
thank you
**************************************************************************************
typedef union
{
uint32 R;
uint16 H;
} Test_u;
**************************************************************************************

답변 (2개)

Anurag Ojha
Anurag Ojha 2024년 5월 8일
Hello
You can refer to following file exchange link to get more information:
I hope this helps you resolve your query
  댓글 수: 3
WJKIM
WJKIM 2024년 5월 13일
Hello,
I have a question about your link.
I found the 'TempBus' in *.m file. And its configuration of code generation is as follow:
Data scope : Imported
Header file : DataTypeImport.h
However, i don't find the DataTypeImport.h file.
Could you tell me where it is? How can i get that?
Meghna
Meghna 2024년 7월 16일 23:51
Hello,
Following up on this as well, how is the header supposed to look/are there any examples?
Thanks!

댓글을 달려면 로그인하십시오.


Angelo Yeo
Angelo Yeo 2024년 5월 8일
Hi @WJKIM,
Current Simulink bus does not support union. Could we get a clearer understanding of why you want to realize the Simulink.Bus object as a union in the generated code? Is there any particular use case for this request?
  댓글 수: 1
WJKIM
WJKIM 2024년 5월 10일
Hi.
I respond to that.
If there are many flags (for example, Fault Flags), i can save memory space by using union.
This is only my opinion.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Deployment, Integration, and Supported Hardware에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by