# HG changeset patch # User Avinoam # Date 1439972343 -10800 # Wed Aug 19 11:19:03 2015 +0300 # Node ID f642c5c47ba71bddb5dadc45fcd3faf5bfae06d9 # Parent 1bedc45745c1a244c5e0dab2adb892a948812714 graythresh: fix the result of a corner case (bug #45333) diff -r 1bedc45745c1 -r f642c5c47ba7 inst/graythresh.m --- a/inst/graythresh.m Mon Aug 17 01:04:58 2015 +0300 +++ b/inst/graythresh.m Wed Aug 19 11:19:03 2015 +0300 @@ -238,6 +238,12 @@ total_variance = sum (((bins - total_mean).^2) .* norm_hist); thresh{2} = max (bcv) / total_variance; endif + + if (~isfinite(max(bcv))) + thresh{1} = 0; + thresh{2} = 0; + endif + endfunction function level = moments (y)