Mercurial > hg > octave-lyh
diff scripts/image/gray.m @ 6791:be31a048c449
[project @ 2007-07-24 19:04:51 by dbateman]
author | dbateman |
---|---|
date | Tue, 24 Jul 2007 19:04:51 +0000 |
parents | c81a0f3f5a82 |
children | 93c65f2a5668 |
line wrap: on
line diff
--- a/scripts/image/gray.m +++ b/scripts/image/gray.m @@ -21,7 +21,7 @@ ## @deftypefn {Function File} {} gray (@var{n}) ## Return a gray colormap with @var{n} entries corresponding to values from ## 0 to @var{n}-1. The argument @var{n} should be a scalar. If it is -## omitted, 64 is assumed. +## omitted, the length of the current colormap or 64 is assumed. ## @end deftypefn ## Author: Tony Richardson <arichard@stark.cc.oh.us> @@ -31,8 +31,12 @@ function map = gray (number) if (nargin == 0) - number = 64; - elseif (nargin > 1) + number = rows (colormap); + elseif (nargin == 1) + if (! isscalar (number)) + error ("gray: argument must be a scalar"); + endif + else print_usage (); endif