MATLAB: How to record 2 peak values pass a specific number on the X axis

axisdatafigfigurepeaksvaluesxy

I attached a .fig file to help describe the data(PeakValues.fig, but if the attachment is missing, someone let me know.). Download the file to see the data.
There are three peaks recorded in the data above 4 on the Y-axis. However, I would like to record only the two peaks past 300 on the X-axis. I would like to record both x and y values of the two peaks and assign each x and y to a variable for finding the midpoint(ex. x1,y1 and x2,y2). What codes would be recommended to record the max values of two peaks if I only want the peaks pass 300?

Best Answer

I understand that you want to record the peaks past 300. In that case you could limit your data to values past 300. For example if data is stored in variable called ‘data’, you could use something like:
[pks,locs] = findpeaks(data(300:end))
Where the 'pks' variable would contain your y1 and y2 values and 'locs' would have x1 and x2, which would record the max values of only two peaks.