필터 지우기
필터 지우기

Inf and NaN entities in C-code when using Matlab Coder

조회 수: 17 (최근 30일)
Dani Tormo
Dani Tormo 2014년 8월 5일
답변: Mike Hosea 2014년 9월 15일
Hello,
I have a script in Matlab where I use Inf and NaN entities. I used Matlab Coder to generate C-code.
The problem arises in the C-code when using the function rtGetInf() to initialize rtInf (Inf number in Matlab). This function returns zero.
Why is that and how should I solve it?
I haven't looked where I use the NaN but I guess I'll face a similar problem.
I'm using Visual Studio 2010 Professional to compile the generated C-Code into a library to be used in PSCAD.
Thanks a lot! Dani
  댓글 수: 1
Ryan Livingston
Ryan Livingston 2014년 8월 6일
편집: Ryan Livingston 2014년 8월 6일
Hi Dani,
To clarify, you have generated some C code and you are calling it from C code you are writing in Visual Studio, correct?
If so, are you including calls to the initialize function in the file foo_initialize.h? That function should be called once before invoking the generated code. Similarly foo_terminate should be called when you are done using the generated code. The example:
shows calling generated code from Visual Studio. Particularly, step 6 mentions the initialize and terminate functions.

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

채택된 답변

Mike Hosea
Mike Hosea 2014년 9월 15일
Ryan's comment is the answer to this question. The initialize function must be called.

추가 답변 (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