convert excel time to time in a matlab
19 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Lucas
el 15 de Nov. de 2022
Respondida: Campion Loong
el 18 de Nov. de 2022
In excel file (.csv) column A is in format of (12:37:48.123 AM) and I want to have it in MatLab as 12:37:48.123
I tried using the following code:
UTCtime = datetime(dat(8:lastindex), 'Format', 'hh:mm:ss:SSS a')
But got this error:
Error using datetime (line 597)
Numeric input data must be a matrix with three or six columns, or else three, six, or seven separate numeric arrays. You can also create datetimes
from a single numeric array using the 'ConvertFrom' parameter.
Error in Event_129_BATS02 (line 91)
UTCtime = datetime(dat(8:lastindex), 'Format', 'hh:mm:ss:SSS a')
Please help.
0 comentarios
Respuesta aceptada
Campion Loong
el 18 de Nov. de 2022
Simply use 'InputFormat' to parse the excel timestamp, and 'Format' to display it in your format of choice
% Made up data - you can parse an array in one call
excel_timestamp = ["12:37:48.123 AM"; "1:34:42.153 AM"; "3:25:31.635 AM"];
% Use the "InputFormat" & "Format" Name/Value pairs right at construction
datetime(excel_timestamp,"InputFormat","hh:mm:ss.SSS a", "Format", "hh:mm:ss.SSS")
0 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Dates and Time en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!