changeset 9809:965487e00282

stairs.m (__stairs__): correct nargin check; new demos
author John W. Eaton <jwe@octave.org>
date Wed, 11 Nov 2009 17:52:14 -0500
parents 873ec09e387a
children 7c211d0091d9
files scripts/ChangeLog scripts/plot/stairs.m
diffstat 2 files changed, 13 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/ChangeLog	Wed Nov 11 15:22:27 2009 -0500
+++ b/scripts/ChangeLog	Wed Nov 11 17:52:14 2009 -0500
@@ -1,3 +1,8 @@
+2009-11-11  John W. Eaton  <jwe@octave.org>
+
+	* plot/stairs.m (__stairs__): Correct nargin check.  New demos.
+	From Jakub Kasse <jakub.kasse@tul.cz>.
+
 2009-11-11  John W. Eaton  <jwe@octave.org>
 
 	* help/help.m (help): Return immediately after calling do_contents.
--- a/scripts/plot/stairs.m	Wed Nov 11 15:22:27 2009 -0500
+++ b/scripts/plot/stairs.m	Wed Nov 11 17:52:14 2009 -0500
@@ -80,7 +80,7 @@
 
 function [h, xs, ys] = __stairs__ (doplot, varargin)
 
-  if (nargin == 1 || ischar (varargin{2}))
+  if (nargin == 2 || ischar (varargin{2}))
     y = varargin {1};
     varargin(1) = [];
     if (ismatrix (y))
@@ -217,6 +217,13 @@
 %! [xs, ys] = stairs (x, y);
 %! plot (xs, ys);
 
+%!demo
+%! stairs (1:9);
+
+%!demo
+%! [xs, ys] = stairs (9:-1:1);
+%! plot (xs, ys);
+
 function update_props (h, d)
   set (get (h, "children"), "color", get (h, "color"), 
        "linewidth", get (h, "linewidth"),