Problem with formatting time
Info
Diese Frage ist geschlossen. Öffnen Sie sie erneut, um sie zu bearbeiten oder zu beantworten.
Ältere Kommentare anzeigen
I have a column of times in the format:
HH:MM:SS.FFF
(so seconds are to 3 decimal places). I'm trying to import this column but I can't find a way to format it properly. I've tried custom formatting, namely:
HH:MM:SSSSSS HH:MM:SSSSS HH:MM:SS.SSS
but am being returned "NaN", and:
HH:MM:SS.FFF
but I'm getting an exponential number instead. I'd really like to get it in the hour-min-sec format. What should I do?
Antworten (1)
Please post exactly what you do: What is the input source? A file, a cell string, a string? With which function or tool do you want to import the values?
The "exponential number" you get is the serial date format. You can simply convert it by datevec or datestr depending on what "hour-min-sec format" exactly mean.
It might be cheaper to treat the date string as a string and import it as numerical values directly by:
%d:%d:%f
Diese Frage ist geschlossen.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!