필터 지우기
필터 지우기

How to optimize the coder generated code to use pointer as input instead of structure ?

조회 수: 9 (최근 30일)
My matlab function is this :
[staticAlign_output, per_var] = staticAlignment(staticAlign_input, staticAlign_output, detn_reports, per_var, sa_cals)
Therefore the auto generated c code for this function is like this:
void staticAlignment(const staticAlign_Input_T staticAlign_input,
staticAlign_Output_T *staticAlign_output,
const Detection_Reports_T detn_reports , Per_Var_T *per_var, const
Cals_Static_Align_T sa_cals)
So it calls the sttucture Detection_Reports_T as the input. Since this is a huge structure, we prefer to use pointer instead of structure.
Is there a command to fix this ?
Thanks

채택된 답변

Fred Smith
Fred Smith 2013년 11월 7일
If you make detn_output an output as well, then it will be passed by pointer.
What version of MATLAB Coder are you using? In the latest release (I believe), all structures should always be passed by reference.
  댓글 수: 2
Liang MA
Liang MA 2013년 12월 19일
Right now , we just have to put it as output as well so that we can have pointer used. In 2013B, it is still not passing structures by reference yet.
Ketan
Ketan 2013년 12월 26일
편집: Ketan 2013년 12월 26일
There is configuration option "PassStructByReference" that controls this behavior for entry-point functions in R2013b. Search for "PassStructByReference" on the following page for more info:

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

추가 답변 (0개)

카테고리

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