From bug-request at octave dot org Thu Jan 27 09:18:05 2005 Subject: median fails for scalar input From: "Hall, Benjamin" To: "'bug at octave dot org'" Date: Thu, 27 Jan 2005 07:52:38 -0600 Starting with octave 2.1.60, it appears that the median function fails when given a scalar input median(3) error: median: invalid matrix argument A one character fix would be: *** median.m 2005-01-27 08:47:54.000000000 -0500 --- orig/median.m 2005-01-27 08:46:46.000000000 -0500 *************** *** 61,67 **** sz = size (a); s = sort (a, dim); ! if (numel (a) > 0) if (numel (a) == sz(dim)) if (rem (sz(dim), 2) == 0) i = sz(dim) / 2; --- 61,67 ---- sz = size (a); s = sort (a, dim); ! if (numel (a) > 1) if (numel (a) == sz(dim)) if (rem (sz(dim), 2) == 0) i = sz(dim) / 2; ------------------------------------------------------------- Octave is freely available under the terms of the GNU GPL. Octave's home on the web: http://www.octave.org How to fund new projects: http://www.octave.org/funding.html Subscription information: http://www.octave.org/archive.html -------------------------------------------------------------