How do I get the value of seconds in a datetime table?
10 次查看(过去 30 天)
显示 更早的评论
I collected some acceleration values using the matlab application, however i don't know how to convert the timestamps to seconds elapased.
2 个评论
dpb
2020-12-3
'Pends. Are the timestamps real time or some other measure?
If real time, then just subtract the first value from the data.
回答(1 个)
Cris LaPierre
2020-12-3
编辑:Cris LaPierre
2020-12-3
+1 to dpb's comment. Subtracting datetimes gives you a duration. You can convert your duration to your desired units - days, hours, minutes, seconds, etc by setting the duration format. See more here.
% Create a vetor of times
t = datetime('now') + minutes(1:0.25:3)
% compute elapsed time
dt = t - t(1)
% convert elapsed time to seconds
dt.Format = 's'
0 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!