How to convert table with datetime in numeric (seconds)

7 visualizzazioni (ultimi 30 giorni)
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 Commenti
Stephen23
Stephen23 il 18 Lug 2022
@Miriam: please save your data (table) in a mat file, and then upload it by clicking the paperclip button.
Miriam
Miriam il 18 Lug 2022
Modificato: Miriam il 18 Lug 2022
The mat file is attached here now

Accedi per commentare.

Risposta accettata

Abderrahim. B
Abderrahim. B il 18 Lug 2022
Hi!
Try this:
load Zeitt.mat
time_sec = seconds(Zeitt.Time - Zeitt.Time(1))
Hope this helps

Più risposte (0)

Categorie

Scopri di più su Dates and Time in Help Center e File Exchange

Prodotti


Release

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by