--- scripts/statistics/base/quantile.m_orig 2014-08-07 03:57:55.000000000 +1000 +++ scripts/statistics/base/quantile.m 2015-07-03 12:42:19.439780197 +1000 @@ -114,8 +114,8 @@ print_usage (); endif - if (! (isnumeric (x) || islogical (x))) - error ("quantile: X must be a numeric vector or matrix"); + if (! (isnumeric (x) || islogical (x)) || isempty (x)) + error ("quantile: X must be a non-empty numeric vector or matrix"); endif if (isempty (p)) @@ -331,7 +331,7 @@ ## Save length and set shape of samples. ## FIXME: does sort guarantee that NaN's come at the end? - x = sort (x); + x = sort (x, 1); m = sum (! isnan (x)); [xr, xc] = size (x); @@ -403,7 +403,7 @@ endswitch ## Duplicate single values. - imm1 = (mm == 1); + imm1 = (mm(1,:) == 1); x(2,imm1) = x(1,imm1); ## Interval indices.