Does NaN used in confusion matrix affects results?
1 回表示 (過去 30 日間)
古いコメントを表示
I have used confusion matrix and for making two matrices of equal dimensions I had used NaN but is it wise to use that? for example: A= [2 3 7 ]; B= [3 4 NaN]; C= A+B; C= 5 7 NaN I am getting where result should have been [5 7 7] according to me.Can anyone help? Thanx in advance.
3 件のコメント
採用された回答
Chad Greene
2016 年 6 月 16 日
Here's one way:
C = nansum([A; B])
C =
5 7 7
2 件のコメント
Chad Greene
2016 年 6 月 17 日
Using NaN as a place filler is often the best way to do it. The reason 1+NaN=NaN is because Matlab doesn't what the answer is if you add a number to something that is not a number. But the nansum function and its sisters (nanmean, nanmedian, etc) are available to simply ignore NaNs the way you want.
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Creating and Concatenating Matrices についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!