From bug-request at octave dot org Thu Jan 27 09:44:47 2005 Subject: Re: median fails for scalar input From: David Bateman To: "Hall, Benjamin" Cc: bug at octave dot org Date: Thu, 27 Jan 2005 16:46:09 +0100 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; > > > My fault, though this has been there since 2.1.58 :-) D. -- David Bateman David dot Bateman at motorola dot com Motorola CRM +33 1 69 35 48 04 (Ph) Parc Les Algorithmes, Commune de St Aubin +33 1 69 35 77 01 (Fax) 91193 Gif-Sur-Yvette FRANCE The information contained in this communication has been classified as: [x] General Business Information [ ] Motorola Internal Use Only [ ] Motorola Confidential Proprietary ------------------------------------------------------------- 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 -------------------------------------------------------------