MATLAB: HOW extract a particular value from graph on Y-axis based on defined X-axis values

amplitudeaudiofigureMATLABmirtoolboxplotplotting dataSignal Processing ToolboxStatistics and Machine Learning Toolbox

I have a plot that represents the amplitude values of an audio file corresponding to the time represented in seconds. Now I want to extract the amplitude values in second by second(ex: 1s – amplitude value, 2s- amplitude value.. etc.) from this figure.
From the following code I can extract the all the X & Y values to a text file. But how I can extract the corresponded amplitude values (Y axis) in second by second (X axis).
clear all,
close all;
clc;
h=openfig('11.fig')
h = findobj(gca,'Type','line')
x=get(h,'Xdata')
y=get(h,'Ydata')
A=[];
A(:,1)=x;
A(:,2)=y;
dlmwrite('data.txt',A,',');
Please help me.. I just want to obtain the data value of a defined range in the X axis.

Best Answer

Read about interp1.
Related Question