From bug-request at octave dot org Wed Apr 5 11:25:40 2006 Subject: Plot should be able to handle empty vector inputs From: Quentin Spencer To: octave bug mailing list Date: Wed, 05 Apr 2006 11:20:51 -0500 In Matlab, it is possible to call the plot function with empty data. This is an error >> plot([]) ??? Error using ==> plot Vectors must be the same lengths. However, this is acceptable. >> plot([],[]) In octave, I get the following error: oct 1> plot([],[]) error: __plt2__: invalid data for plotting error: evaluating if command near line 48, column 3 error: called from `__plt2__' in file `/usr/share/octave/2.9.4/m/plot/__plt2__.m' error: evaluating if command near line 58, column 4 error: evaluating if command near line 56, column 2 error: evaluating if command near line 55, column 7 error: evaluating while command near line 44, column 5 error: evaluating if command near line 34, column 3 error: called from `__plt__' in file `/usr/share/octave/2.9.4/m/plot/__plt__.m' error: called from `plot' in file `/usr/share/octave/2.9.4/m/plot/plot.m' Supporting this behavior is useful because I have a situation where I'm plotting several vectors, and one pair of them may be empty, but I don't know in advance without extra code to check for it. As you can see, this is version 2.9.4, but looking at CVS, it looks like this hasn't changed since then. I might be able to write a patch for this, but I don't have time right now--maybe later if I'm the first one to get to it. -Quentin ------------------------------------------------------------- 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 -------------------------------------------------------------