필터 지우기
필터 지우기

MATLAB Coder not generating C code

조회 수: 5 (최근 30일)
Grant Harley
Grant Harley 2023년 6월 21일
답변: Harsh Saxena 2023년 6월 22일
I am using MATLAB coder to try and make an executable function; however, after generating the C source file for the function the code just looks like below.
void testscriptfunc(real_T i)
{
(void)i;
/* comments */
}
It seems to skip all the code in my function and only generates anything I have commented out in the function ias a comment in the C code. When I try generating the code as a MEX function using C it seems to work correctly but when generating any source code it generates something like the code above. Does anyone have any ideas as to what could be causing this?
  댓글 수: 1
Walter Roberson
Walter Roberson 2023년 6월 21일
Perhaps the function returns nothing and has no side effects, then the complete source code could be optimized away.

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

답변 (1개)

Harsh Saxena
Harsh Saxena 2023년 6월 22일
Hi Grant,
This usually happens when if the function in question does not return anything and has no other side-effects. In this case the MATLAB coder wil optimize the entire function.
Hope this helps!

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by