Only display warning once (for one time step) in diagnostic viewer
16 次查看(过去 30 天)
显示 更早的评论
Dear supporters,
i´m currently implementing a NaN/Inf detection in my simulink model. My approach is to do it with the diagnostics and it almost works fine. I enabled the warning for Inf/NaN, but now it outputs 16000 warnings as my model is running in a loop. (One warning for each time step if NaN/Inf was found) Is it possible to avoid that and only get one warning for each Inf/NaN that was found in the whole process (-> avoid the output for each time step?)?
Thanks for your help in advance, if there are further questions, i can clarify the question.
0 个评论
回答(1 个)
Mathias Smeets
2022-8-4
Set some parameter at the start of your code, for example
warning_displayed = false;
Now put an if statement around your warning
if ~warning_displayed
warning('your warning')
warning_displayed = true;
end
Does this help?
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Configure and View Diagnostics 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!