# HG changeset patch # User Rik # Date 1379626845 25200 # Node ID 93d2239b7fe9b85ca6944b03f5394ceefc765d4a # Parent 359366a4994f8f9132fdcc98605b0652feea0697 waitforbuttonpress.m: Change return value 'a' to 'b' to match documentation. * scripts/plot/waitforbuttonpress.m: Change return value 'a' to 'b' to match documentation. Add %!error tests for input validation. diff -r 359366a4994f -r 93d2239b7fe9 scripts/plot/waitforbuttonpress.m --- a/scripts/plot/waitforbuttonpress.m Thu Sep 19 14:26:47 2013 -0700 +++ b/scripts/plot/waitforbuttonpress.m Thu Sep 19 14:40:45 2013 -0700 @@ -18,7 +18,7 @@ ## -*- texinfo -*- ## @deftypefn {Function File} {} waitforbuttonpress () -## @deftypefnx {Function File} {@var{b} =} waitforbuttonpress () +## @deftypefnx {Function File} {@var{a} =} waitforbuttonpress () ## Wait for mouse click or key press over the current figure window. ## ## The return value of @var{b} is 0 if a mouse button was pressed or 1 if a @@ -30,7 +30,7 @@ ## Author: Petr Mikulik ## License: public domain -function a = waitforbuttonpress () +function b = waitforbuttonpress () if (nargin != 0 || nargout > 1) print_usage (); @@ -40,11 +40,16 @@ if (nargout == 1) if (k <= 5) - a = 0; + b = 0; else - a = 1; + b = 1; endif endif endfunction + +%% Test input validation +%!error waitforbuttonpress (1) +%!error [a,b,c] = waitforbuttonpress () +