# HG changeset patch # User Nicholas R. Jankowski # Date 1677870258 18000 # Node ID 3bdfda4f7c16363ee3bd74b8b4fe29c749710c4b # Parent 95e06f13fde38936752685f76dfc21b96f2f6977 mean.m: correct regression on default on dim error (bug #63410) * mean.m: Change input validation check for 'dim' option to catch Inf inputs. Re-add input validation BISTs to check for error handling of negative, NaN, and Inf inputs that were dropped with patch #10314. diff -r 95e06f13fde3 -r 3bdfda4f7c16 scripts/statistics/mean.m --- a/scripts/statistics/mean.m Fri Mar 03 10:11:36 2023 +0100 +++ b/scripts/statistics/mean.m Fri Mar 03 14:04:18 2023 -0500 @@ -219,8 +219,8 @@ ## Two numeric input arguments, dimensions given. Note scalar is vector! vecdim = varargin{1}; - if (isempty (vecdim) || ! (isvector (vecdim) && all (vecdim > 0)) - || any (rem (vecdim, 1))) + if (isempty (vecdim) || ! (isvector (vecdim) && all (vecdim > 0) + && all (rem (vecdim, 1)==0))) error ("mean: DIM must be a positive integer scalar or vector"); endif @@ -629,6 +629,10 @@ %!error mean (1, 1.5) %!error mean (1, 0) %!error mean (1, []) +%!error mean (1, -1) +%!error mean (1, -1.5) +%!error mean (1, NaN) +%!error mean (1, Inf) %!error mean (repmat ([1:20;6:25], [5 2]), -1) %!error mean (repmat ([1:5;5:9], [5 2]), [1 -1]) %!error mean (1, ones(1,0))