How to create the designed simulink block with the desired Inline function

조회 수: 3 (최근 30일)
WJKIM
WJKIM 2024년 5월 3일
이동: Angelo Yeo 2024년 5월 7일
hello.
I have a question about how to create an inline function in simulink coder.
I understand that you can select Inline in the Code Generation Tab of 'Block Parameters' in Simulink.
However, this is not the way I want to generate code.
Does Mathoworks support the method of generating code in the form of an inline void function as shown below?
If so, could you tell me how?
thank you
**************************************************************************************
static inline uint16_t CTRL_Clamp(float32_t *data, float32_t Umax, float32_t Umin)
{
return ;
}
**************************************************************************************

답변 (1개)

Angelo Yeo
Angelo Yeo 2024년 5월 3일
The hard inline option within "Function Packaging" seems not to meet your needs. Unfortunately, there's currently no method to prefix functions with the C inline keyword specifier.
It would be the best if you can provide us with the reason you prepfer to add inline specifier instead of explicitly inlining the code. This would greatly assist us in prioritizing the development of this feature.
  댓글 수: 1
WJKIM
WJKIM 2024년 5월 7일
이동: Angelo Yeo 2024년 5월 7일
Thank you for answer.
There are pros and cons to each method, but basically we were considering two main things.
First, when using the same (Iniline) function
> The same inline code is generated in multiple places, increasing the number of codes.
> You can use a Reuseable Function, but it is not inline.
Second, code readability
> Even if you generate inline code, when you look at the generated code, it appears that it will be easier to read when debugging if it is divided into functions.

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

카테고리

Help CenterFile Exchange에서 Simulink Coder에 대해 자세히 알아보기

제품


릴리스

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by