Converting instances of NaN to 0 and setting bold as reminder
1 次查看(过去 30 天)
显示 更早的评论
May_the_degrees_of_freedom_be_with_you
2020-3-19
评论: May_the_degrees_of_freedom_be_with_you
2020-3-30
I'm working with signal detection, and frequently the denominator of my fractions is zero (e.g., Sensitivity = True Positive / (True Positive + False Positive)). When the denominator is 0, this returns NaN. For further analysis, I'd like to convert NaN to 0, but because these 0's will be meaningfully different from other cases (e.g., TP = 0, FP = 1; so, 0 / (0 + 1) = 0), I'd like to set these values and any further products of them to bold font.
Question 1: Does this solution make sense mathematically? Some stackexchange forums recommended setting NaN values in this case to 0, but I'd feel better about it if I knew the Matlab community agreed.
Question 2: How can I communicate this to Matlab? The example code below returns Inf rather than NaN, but the if statement doesn't do anything to "quo". By itself, "quo(isinf(quo)) = 0" works, but setBold does not and I'm not sure how to indicate that I want all further computations from that 0 to also be bold.
a = [2 4 6]
b = [4 2 0]
quo = a ./ b
if quo == Inf
quo(isinf(quo)) = 0
setBold(quo, 'true')
end
Thank you in advance!
2 个评论
Image Analyst
2020-3-20
Exactly what will be bolded? Are you displaying quo on a user interface of some kind?
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Numeric Types 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!