MATLAB Answers

0

How to make Embedded coder use isnan C-API than implementing custom code?

Asked by Ritesh Rajore on 24 May 2019
Latest activity Edited by Ritesh Rajore on 24 May 2019
My Simulink model uses NaN and some places there is check of same using matlab function isnan().
When I am genertaing C-code using embedded coder, i see generated code has custom implementation of isnan function like below
/* Test if value is not a number */
boolean_T rtIsNaN(real_T value)
{
return (boolean_T)((value!=value) ? 1U : 0U);
}
How can I avoid this and allow EC to use isnan API from math.h from my toolchain. If I use above implementation, it doesnot work as expected in some of my cores which doesnt have FPU. Replacing this and Calling isnan() from math.h works fine for me.
I did web-search but couldnt find any help on this topic.

  0 Comments

Sign in to comment.

2 Answers

Naman Bhaia 님의 답변 24 May 2019

I believe Code Replacement Customization can be the possible solution. To implement that, you could develop a code replacement library by referring to this link.

  0 Comments

Sign in to comment.


Ritesh Rajore 님의 답변 24 May 2019
Ritesh Rajore 님이 편집함. 24 May 2019

I tried this but it is not reflecting. I defined replacemnet function of rtIsNaN as isnan but I see EC is generating the code as earlier.
In my model, piece of code where nan and its validation is done is in m-file. Not sure if code replacement is applicable for m-file code.

  0 Comments

Sign in to comment.