function P=allpeaks(x,y)
% Looks for data points in x,y that have a y value greater than the
% adjacent points, then prints out the peak number, x value, and y value of
% those points. (Noisy data must be smoothed first).
% Example:
%  x=2:38
%  y=abs(randn(size(x)));
%  P=allpeaks(x,y);
%  disp('           peak      position      height')
%  disp(P)
%  plot(x,y)
%  text(P(:,2),P(:,3),num2str(P(:,1))) % Numbers peaks
%
peak=0;
for k = 2:length(x)-1
   if y(k) > y(k-1)
       if y(k) > y(k+1)
           peak = peak + 1;
           P(peak,:)=[peak x(k) y(k)];
       end
   end  
end