Effacer les filtres
Effacer les filtres

Only display warning once (for one time step) in diagnostic viewer

12 vues (au cours des 30 derniers jours)
Tom
Tom le 4 Août 2022
Commenté : Mathias Smeets le 4 Août 2022
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.

Réponses (1)

Mathias Smeets
Mathias Smeets le 4 Août 2022
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?
  2 commentaires
Tom
Tom le 4 Août 2022
@Mathias Smeets thanks for your answer, but it doesn't really help. I don´t have any code, as it is only a simulink model. I am actually not that experienced with simulink. Furthermore the warning also includes the timestamp, so your approach wouldn´t work as it is a different text for each warning, even if it´s caused by the same mistake.
Do you have any other ideas?
Mathias Smeets
Mathias Smeets le 4 Août 2022
No I don't know sorry

Connectez-vous pour commenter.

Catégories

En savoir plus sur Configure and View Diagnostics dans Help Center et File Exchange

Produits


Version

R2020b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by