function [Xt,Yt]=truncSpectra(X,Y)
%cut off spectra with wavenumber beneath 150 and over 4000
Spectra=[X,Y]; %Spectra of glass sort from lowest to highest wavenumber to be consistent with the
            %correction function.
%sorts rows in ascending order if not that way already            
Spectra=sortrows(Spectra,1);
figure;subplot(3,1,1);plot(X,Y);
subplot(3,1,2);plot(Spectra(:,1),Spectra(:,2));

if min(Spectra(:,1))<150
Index1=max(find(Spectra(:,1)<150));
else Index1=1;
end

if(max(Spectra(:,1))>4000)
Index2=min(find(Spectra(:,1)>4000));
else Index2=size(Spectra(:,1),1);
end

Index1
Index2
Spectra=Spectra(Index1:Index2,:);
Xt=Spectra(:,1);
Yt=Spectra(:,2);
subplot(3,1,3);plot(Xt,Yt)