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!