Detect Inf or Nan in Embedded Matlab Function block
6 次查看(过去 30 天)
显示 更早的评论
Is there a way to detect an Inf or Nan being calculated inside an Embedded Matlab block. Simulink does not produce an error, but when we generated code, an exception was found. We are looking to protect against them. The problem can be reduced to the following.
[Constant block=0] --> [Embedded MATLAB Function] --> [Display]
Embedded MATLAB Function
function y = fcn(u)
test = 1/u;
if test > 0
y = 1;
else
y = 0;
end
"Configuration Parameters > Diagnostics > Data Validity > Inf or NaN block output", is just that, checking block output, and does not report this. (Which surprised me.)
Note: Simulink 6.6.1
Thanks.
0 个评论
采纳的回答
Azzi Abdelmalek
2013-2-7
Use isnan or isinf function
4 个评论
Azzi Abdelmalek
2013-2-8
Maybe there is a way to disable such error message in configuration parameters. I will check it.
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Data Types 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!