function [a,cm] = gray2ind(b,n)
%GRAY2IND Convert gray scale intensity image to indexed image.
%	[X,MAP] = GRAY2IND(I,N) converts the gray scale intensity
%	image I to an indexed image X with colormap GRAY(N).
%
%	[X,MAP] = GRAY2IND(I) returns the image X as indices into
%	the standard gray colormap GRAY(64).
%
%	See also IND2GRAY, CMUNIQUE.

%	Clay M. Thompson 10-5-92
%	Copyright (c) 1992 by The MathWorks, Inc.
%	$Revision: 1.9 $  $Date: 1993/09/09 17:39:58 $

if nargin<1, error('Not enough input arguments.'); end
if nargin==2,
  a = round(b*(n-1))+1;
  cm = gray(n);
else
  n = 64;	% Default colormap size
  a = round(b*(n-1))+1;
  cm = gray(n);
end
