function changeRGBChannel
% Handles what happens when user wants to select an RGB channel
% Kevin Baggett
% Thu May  1 17:49:58 GMT 2003

h=guidata(gcf);

h1=guidata(1);
colorToChange=get(gcbo,'String');
f=openfig('rgbChannel');
hRGB=guihandles(f);
hRGB.wavenumbers=h1.wavenumbers; %attach wavenumbers to the figure for selection
guidata(f,hRGB);
axes(hRGB.axDisplay);
%plot entire spectra for a randomly selected pixel
r=random('unid',12150); %always 12150 (135x90) AIRS pixels
plot(h1.wavenumbers,h1.radiances(:,r));
xlabel('Wavenumber (cm^{-1})');
ylabel('Radiance (mW/m^2/ster/cm^{-1})')
randLat=reshape(h1.latitude,12150,1);
randLon=reshape(h1.longitude,12150,1);
	
title(sprintf('Spectra at %7.4f, %7.4f (Randomly selected)',randLat(r),randLon(r)));
waitfor(f); % selectedBand and wavenumber attached to main figure here
h1=guidata(1); % reload main figure's guidata to get access to rgbSelection
switch colorToChange
case 'Change Red'
    h.redWavenumber=h1.rgbSelection;
    set(h.txtRedValue,'String',sprintf('%7.4f',h.redWavenumber));
case 'Change Green'
    h.greenWavenumber=h1.rgbSelection;
    set(h.txtGreenValue,'String',sprintf('%7.4f',h.greenWavenumber));
case 'Change Blue'
    h.blueWavenumber=h1.rgbSelection;
    set(h.txtBlueValue,'String',sprintf('%7.4f',h.blueWavenumber));
end

guidata(gcf,h);    
