function sdata=scatterplot(xch,ych,ops,rect,pathname,filename,displayAxis,label,gColor,indxToRemove)
%Makes a scatter plot of selected combination of bands
%Input: Arrays of x and y channels
%       Ops array
%       Rectangle structure corresponding to selected region
%       Pathname and filename of hdf file
%       Axis to display image on
%       Labels to put on plot
%       Color to plot
%Output:Scatter Plot data
%Kevin Baggett
%Fri Jul 27 16:15:25 UTC 2001

x1=buildNewChannel([pathname filename],rect,xch(1:2),ops(1));
xzero=length(find(xch(3:4)==0));
if ~xzero
    x2=buildNewChannel([pathname filename],rect,xch(3:4),ops(3));
end
y1=buildNewChannel([pathname filename],rect,ych(1:2),ops(4));
yzero=length(find(ych(3:4)==0));
if ~yzero
    y2=buildNewChannel([pathname filename],rect,ych(3:4),ops(6));
end

if exist('x2')
    sdata.x=performop(ops(2),x1,x2);
else
    sdata.x=x1;
end

if exist('y2')
    sdata.y=performop(ops(5),y1,y2);
else
    sdata.y=y1;
end
% remove clear sky pixels from consideration if requested
if nargin==10
    sdata.x(indxToRemove)=NaN;
    sdata.y(indxToRemove)=NaN;
end

rescatter(sdata,displayAxis,label,gColor);
