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!