Trouble reading date/time with milliseconds using xlsread
1 view (last 30 days)
Show older comments
I am using MATLAB version 2013b on a PC running Windows 7.
I have a spreadsheet that includes date/time in the following format: dd/mm/yyyy hh:mm:ss.fff such as 17/03/2014 0:24:22.875
When I read the spreadsheet using either xlsread or readtable, the time is read in as text but does not include the milliseconds (instead it rounds to the nearest second). For example, the above time is read in as '3/17/2014 12:24:23 AM'. I can not get it to read in the milliseconds.
I’ve tried:
[num,txt] = xlsread( spreadsheet, worksheet ) [num,txt,raw] = xlsread( spreadsheet, worksheet ) T = readtable( spreadsheet, ‘Sheet’, worksheet )
and none of them will read in the milliseconds.
3 Comments
dpb
on 31 May 2016
I don't recall this thread; can't believe I didn't try it at the time but apparently didn't owing to the difference in versions. W/ R2012b here it reads the full text string as entered in both the text and raw return fields as expected.
That's for a cell formatted as either 'General' or manually to match the actual data; it doesn't convert the latter to datenum.
But, the string is read in its entirety as I'd expect.
Answers (0)
See Also
Categories
Find more on Data Import from MATLAB in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!