Mercurial > hg > octave-lyh
comparison 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 |
comparison
equal
deleted
inserted
replaced
6790:f1157da78825 | 6791:be31a048c449 |
---|---|
19 | 19 |
20 ## -*- texinfo -*- | 20 ## -*- texinfo -*- |
21 ## @deftypefn {Function File} {} gray (@var{n}) | 21 ## @deftypefn {Function File} {} gray (@var{n}) |
22 ## Return a gray colormap with @var{n} entries corresponding to values from | 22 ## Return a gray colormap with @var{n} entries corresponding to values from |
23 ## 0 to @var{n}-1. The argument @var{n} should be a scalar. If it is | 23 ## 0 to @var{n}-1. The argument @var{n} should be a scalar. If it is |
24 ## omitted, 64 is assumed. | 24 ## omitted, the length of the current colormap or 64 is assumed. |
25 ## @end deftypefn | 25 ## @end deftypefn |
26 | 26 |
27 ## Author: Tony Richardson <arichard@stark.cc.oh.us> | 27 ## Author: Tony Richardson <arichard@stark.cc.oh.us> |
28 ## Created: July 1994 | 28 ## Created: July 1994 |
29 ## Adapted-By: jwe | 29 ## Adapted-By: jwe |
30 | 30 |
31 function map = gray (number) | 31 function map = gray (number) |
32 | 32 |
33 if (nargin == 0) | 33 if (nargin == 0) |
34 number = 64; | 34 number = rows (colormap); |
35 elseif (nargin > 1) | 35 elseif (nargin == 1) |
36 if (! isscalar (number)) | |
37 error ("gray: argument must be a scalar"); | |
38 endif | |
39 else | |
36 print_usage (); | 40 print_usage (); |
37 endif | 41 endif |
38 | 42 |
39 gr = [0:(number-1)]'; | 43 gr = [0:(number-1)]'; |
40 | 44 |