How to extract data from a plot?

2 次查看(过去 30 天)
Hengfeng Wang
Hengfeng Wang 2015-7-8
编辑: Alex 2015-7-8
I got a velocity plot from the acceleration and duration, shown as above. The code is shown as below.
Filename='cycles_ece'
U=xlsread(Filename, 'Table 1');
a_u=U(1:18,4);
t_u=U(1:18,6);
E=xlsread(Filename, 'Table 2');
a_e=E(1:18,4);
t_e=E(1:18,6);
a=[a_u;a_u;a_u;a_u;a_e];
delt=[t_u;t_u;t_u;t_u;t_e];
v=zeros(size(a));
t=zeros(size(delt));
x=-zeros(size(a))
n=numel(a);
for i=1:n
if i==1
v(i)=a(i).*delt(i);
t(i)=delt(i);
else
v(i)=(v(i-1)+a(i).*delt(i));
t(i)=t(i-1)+delt(i);
end
end
plot(t,v)
grid
xlabel('time s')
ylabel('velocity)
Now I want to get the velocity value of every second, i.e. about 1200 points.
So how could I get those values?
Many thanks.

回答(1 个)

Alex
Alex 2015-7-8
编辑:Alex 2015-7-8
If you have the handle available, you can access the data using the XData and YData properties.

类别

Help CenterFile Exchange 中查找有关 Line Plots 的更多信息

产品

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by