wrong time format in table
이전 댓글 표시
I have 100000x4 table with time|voltage|voltage|voltage and i need to plot the voltages vs time. Unfortunately the time column is in the format "d/M/y HH:mm:ss.SSSSSS" and do not start on an absolute zero. how can i extract or change the time from '2/6/2040 00:59:59.999984' in order to make a plot of it?
R2017a
채택된 답변
추가 답변 (1개)
Steven Lord
2017년 6월 27일
If you want to plot the data and have your times stored as a datetime array, just go ahead and plot it. The plot function knows how to handle datetime data.
v = 0:10;
t0 = datetime('today');
t = t0 + days(v);
plot(t, v.^2)
Or if you have t and v and want to plot using the first time in t as the "base time" representing 0:
h = plot(t - t(1), v.^2);
ax = ancestor(h, 'axes');
ax.XAxis.TickLabelFormat = 'd'; % Display the ticks as days not hh:mm:ss
카테고리
도움말 센터 및 File Exchange에서 App Building에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!