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!