NaN with backslash operator
21 次查看(过去 30 天)
显示 更早的评论
采纳的回答
Adam Danz
2019-4-29
The following rows of your variable "B" contain NaN values.
find(isnan(B))
ans =
1491
1492
1493
1494
1495
1496
1497
To ignore the NaN values,
nanIdx = isnan(A) | isnan(B);
A(~nanIdx) \ B(~nanIdx)
ans =
-0.091457
2 个评论
John D'Errico
2019-4-29
The problem being that NaNs propagate. Everything they touch, turns to NaN. (Like old King MIdas, but in an even worse way.) So if you already have NaNs in your data, give it up. You need to excise them from your data before any linear algebra computations.
Steven Lord
2019-4-29
FYI the functions listed in the "Missing Data and Outliers" section of this documentation page may be of use in locating, removing, and/or replacing the NaN values in the data.
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Logical 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!