why is NaN not of 'NaN type' in Simulink?
Mostra commenti meno recenti
Hi everyone,
Please, could anyone explain why the constant block NaN is not of type NaN?

Thank you in advance!
Best regards,
Nicolas
1 Commento
Nicolas CRETIN
il 2 Mag 2024
Risposta accettata
Più risposte (1)
By the definition of NaN, NaN is not equal to anything (including itself.) This is documented on the documentation pages for the NaN function as well as the documentation page for the == operator.
If you can call MATLAB functions in your model, use isequaln to perform equality testing including treating NaN as equal to NaN.
x = NaN;
x == x % false
isequal(x, x) % false
isequaln(x, x) % true
1 Commento
Nicolas CRETIN
il 2 Mag 2024
Categorie
Scopri di più su String in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
