How to extract data from a plot?

1 回表示 (過去 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 Center および File ExchangeLogical についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by