I am trying to compare two .mat files using the Matlab Comparison Tool. In the comparison result the NaN values are highlighted meaning they are different (even though they are not). How can one handle the NaN values when using the Matlab Comparison Tool.

NaNis by definition "not a number". Quoting the documentation,Therefore, mathematically speaking, equality is not even defined between NaN's. For example; trying to compute 0/0 gives NaN, as does 0/0+1. Would you say 0/0 and 0/0+1 are equal? Would you say they are different? Neither: 0/0 and 0/0+1 simply don't exist.
Programmatically, on the other hand,
NaNis a well defined "value", as is equality betweenNaN's: namely,NaNis always unequal toNaN. The rationale of this behaviour is probably the fact that mathematically NaN is undefined, and so it can't be equal to itself.