How to convert table with datetime in numeric (seconds)

조회 수: 7 (최근 30일)
Miriam
Miriam 2022년 7월 18일
댓글: Miriam 2022년 7월 18일
I want to convert a table ('Zeitt' 1000x1 table) with the format 'dd-mmm-yyyy HH:mm:ss.SSS' (ist that right?) like '15-Jul-2022 12:12:43.086' into a number (seconds that passed by since the first date)
I tried many differnt commands, but still got errors, f.e.:
Zeit = datetime(Zeitt, 'InputFormat', 'dd-mmm-yyyy HH:mm:ss.SSS');
or
Zeit=datenum(Zeitt,'dd-mmm-yy HH:mm:ss.SSS',2021);
or
Zeit=convertTo (Zeitt,'.net');
  댓글 수: 2
Stephen23
Stephen23 2022년 7월 18일
@Miriam: please save your data (table) in a mat file, and then upload it by clicking the paperclip button.
Miriam
Miriam 2022년 7월 18일
편집: Miriam 2022년 7월 18일
The mat file is attached here now

댓글을 달려면 로그인하십시오.

채택된 답변

Abderrahim. B
Abderrahim. B 2022년 7월 18일
Hi!
Try this:
load Zeitt.mat
time_sec = seconds(Zeitt.Time - Zeitt.Time(1))
Hope this helps

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Dates and Time에 대해 자세히 알아보기

제품


릴리스

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by