From bug-request at octave dot org Thu Jan 27 10:32:27 2005 Subject: median fails for scalar input From: "John W. Eaton" To: "Hall, Benjamin" Cc: "'bug at octave dot org'" Date: Thu, 27 Jan 2005 11:36:04 -0500 On 27-Jan-2005, Hall, Benjamin wrote: | 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; I applied this patch. BTW, when making diffs it is best to use "diff OLD NEW". That is the way patch expects them to be made, and it is also easier for people to read because they expect to find blocks OLD followed by NEW in the diffs. Thanks, jwe ------------------------------------------------------------- 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 -------------------------------------------------------------