From bug-octave-request at bevo dot che dot wisc dot edu Fri Jan 23 00:14:31 2004 Subject: bar.m From: Stefan van der Walt To: bug-octave at bevo dot che dot wisc dot edu Date: Fri, 23 Jan 2004 08:13:05 +0200 There's a (silly little) bug in bar.m -- when plotting one value only: octave:1> bar([100], [100]) error: invalid vector index = 1 error: evaluating binary operator `-' near line 82, column 29 error: evaluating assignment expression near line 82, column 17 error: evaluating if command near line 75, column 7 error: evaluating if command near line 72, column 5 error: evaluating if command near line 52, column 3 error: called from `bar' in file `/usr/share/octave/2.1.50/m/plot/bar.m' Fix is below. Regards Stéfan *************** *** 75,81 **** if (xlen == ylen) len = 3 * xlen + 1; tmp_xb = tmp_yb = zeros (len, 1); ! cutoff = zeros (1, xlen-1); for i = 1:xlen-1 cutoff(i) = (x(i) + x(i+1)) / 2.0; endfor --- 75,81 ---- if (xlen == ylen) len = 3 * xlen + 1; tmp_xb = tmp_yb = zeros (len, 1); ! cutoff = zeros (1, xlen); for i = 1:xlen-1 cutoff(i) = (x(i) + x(i+1)) / 2.0; endfor ------------------------------------------------------------- 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 -------------------------------------------------------------