Unable to detect datetime or duration data in file for row times
9 次查看(过去 30 天)
显示 更早的评论
TT = readtimetable('ctm.xlsx')
I tried reading the .xlsx file, but it shows the following error
Unable to detect datetime or duration data in file 'D:\Matlab codes\ctm.xlsx'
for row times
First few rows of the spreadsheet which I used is,
Time Deflection
00:00:00 0
00:00:00 2
00:00:00 4
00:00:00 8
00:00:01 16
00:00:01 32
00:00:01 64
2 个评论
Peter Perkins
2021-8-25
Sangani, you are going to need to post the xlsx before this can be diagnosed. There are many things that could be "unusual" in your spreadsheet.
采纳的回答
Jeremy Hughes
2021-8-25
Hi Sangani,
This is a consequence of how Excel stores "time" data. It represents it as a "number" internally, with a custom format that makes it look like a timestamp.
MATLAB cannot tell the difference between this and any other number with a custom format.
T = readtable('ctm.xlsx');
head(T)
T.Time = days(T.Time); % How Excel stores these.
T.Time.Format = "hh:mm:ss.SSS";
TT = table2timetable(T,'RowTimes','Time');
head(TT)
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Timetables 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!