Unable to detect datetime or duration data in file for row times

12 ビュー (過去 30 日間)
Sangani Prithvi
Sangani Prithvi 2021 年 8 月 25 日
コメント済み: Sangani Prithvi 2021 年 8 月 25 日
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
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.
Sangani Prithvi
Sangani Prithvi 2021 年 8 月 25 日
Sure Peter,
I'm attaching my xlsx file here. Please give your suggestions.
Thanks

サインインしてコメントする。

採用された回答

Jeremy Hughes
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)
ans = 8×2 table
Time Deflection __________ __________ 0 0 0 1 2.3148e-06 2 4.6296e-06 4 6.9444e-06 8 1.0417e-05 16 1.1574e-05 32 1.5046e-05 64
T.Time = days(T.Time); % How Excel stores these.
T.Time.Format = "hh:mm:ss.SSS";
TT = table2timetable(T,'RowTimes','Time');
head(TT)
ans = 8×1 timetable
Time Deflection ____________ __________ 00:00:00.000 0 00:00:00.000 1 00:00:00.200 2 00:00:00.400 4 00:00:00.600 8 00:00:00.900 16 00:00:01.000 32 00:00:01.300 64

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeSpreadsheets についてさらに検索

タグ

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by