Importing ISO 8601 Formatted CSV Dates into Matlab R2014b
Mostrar comentarios más antiguos
I am trying to import a CSV file with ISO 8601 formatted dates with Matlab R2014b. I am using the CSV import wizard, and am needing to use the custom date formatter, as the ISO 8601 date format is not built into Matlab.
However, Matlab never recognises the date/time data as date/time data. Can anyone resolve this? The documentation doesn't say anything about how items that are not part of the date format (e.g. the 'T') are parsed.
Picking a string directly for conversion works ok.
>> datenum('"2008-01-01T00:00:00+13:00"', '"yyyy-MM-ddThh:mm:ssZZZZZ"')
ans =
7.3338e+05
But the same conversion does not work in the CSV import wizard, as shown in the screenshot below.

Any particular reason why it works in the command line but not in the import wizard?
Respuestas (1)
per isakson
el 13 de Ag. de 2015
Editada: per isakson
el 14 de Ag. de 2015
It's a mess!
The old functions, datenem, etc., are not updated to honor the new datetime Properties (e.g. Time Zone Offset Formats). And the old functions don't always throw appropriate messages.
"... directly for conversion works ok"   Did you check the result?
>> datestr( datenum('"2008-01-01T00:00:00+13:00"', '"yyyy-MM-ddThh:mm:ssZZZZZ"'), 31 )
ans =
2007-11-30 12:01:00
>> version
ans =
8.2.0.701 (R2013b)
datetime   was officially introduced in R2014b
3 comentarios
Bart Milne
el 14 de Ag. de 2015
Editada: Bart Milne
el 14 de Ag. de 2015
per isakson
el 14 de Ag. de 2015
Editada: per isakson
el 14 de Ag. de 2015
For the time being we have to be aware that
- Matlab have old and new functions to handle date and time
- the date and time formats of the new and the old differ
- the old functions doesn't throw errors for new formats, which they don't interpret correctly
Conclusion: The user must be careful to adhere to the correct parts of the documentation.
Lets hope this "issue" is fixed in R2015a.
per isakson
el 14 de Ag. de 2015
Categorías
Más información sobre Dates and Time en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!