hi.... i have a problem in my code in matlab
i plot my diagram (ECG ) that i get info from database in this site:http://www.physionet.org/ with
now i have ECG diagram in matlab but i want to find value and position of max and min OF ALL OF WAVE ....but with this code i found just one min and one max and i dont know how i can write a loop or for to search and find whole Min and Max of wave with their values in axes y ... in medical field i mean find R-peaks in EKG
thanks alot and my code
x = load ('C:\ekg\example_ecg.txt');
y = x ( : , 2);
h = plot (y );
x = get(h,'XData'); % Get the plotted data
y = get(h,'YData');
imin = find(min(y) == y);% Find the index of the min and max
imax = find(max(y) == y);
text(x(imin),y(imin),[' Min ',num2str(y(imin))],...
'VerticalAlignment','middle',...
'HorizontalAlignment','left',...
'FontSize',7)
text(x(imax),y(imax),['Max ',num2str(y(imax))],...
'VerticalAlignment','bottom',...
'HorizontalAlignment','right',...
'FontSize',7)