the isnumeric function and the NaN
30 次查看(过去 30 天)
显示 更早的评论
I have a matrix array (A) that includes three column arrays. All columns contain integers except that one of the columns also include NaNs. When I type isnumeric(A), the output is a logical value 1. Apparently NaN is recognised as a numeric entry as otherwise MATLAB would return a logical value of 0. How is a NaN recognised exactly?
6 个评论
Stephen23
2018-9-7
编辑:Stephen23
2018-9-7
@Snoopy: The behavior of NaN's within MATLAB operations is explained here:
NaN's are just a particular bit pattern that is assigned to have the value Not-a-Number. To know more about the classes that support NaN's, you need to read about IEEE 754 standard (the well-supported 1985 version), which defines the floating point numbers that MATLAB uses:
This also explains how the numbers are stored, including the "special" values like Inf and NaN:
回答(1 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Logical 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!