--- /home/lachlan/src/octave-4.0.0/scripts/statistics/base/quantile.m 2015-05-24 00:21:53.000000000 +1000 +++ quantile.m 2015-08-18 15:46:03.032151907 +1000 @@ -113,8 +113,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)) @@ -359,7 +359,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); @@ -431,7 +431,7 @@ endswitch ## Duplicate single values. - imm1 = (mm == 1); + imm1 = (mm(1,:) == 1); x(2,imm1) = x(1,imm1); ## Interval indices.