필터 지우기
필터 지우기

Importing excel time data

조회 수: 37 (최근 30일)
MBUNYA NERVILLE ANYANG
MBUNYA NERVILLE ANYANG 2023년 5월 24일
댓글: Mathieu NOE 2023년 5월 25일
I am trying to read an excel file containg the date and time in the format "dd/mm/yyyy HH:MM:SS". (The excel contains eight columns [Date, Time, data1, data2, data3,data4,data5,data6,data7,data8])
I read the excel file with the code
opts = detectImportOptions("LW.xlsx");
T = readtable("LW.xlsx",opts)
T = 240×8 table
Date Time T DH DN E GH Z _____ ________ ____ ___ ___ __ ___ ___ 39083 0 22.7 0 0 0 0 155 39083 0.041667 22.5 0 0 0 0 144 39083 0.083333 22 0 0 0 0 132 39083 0.125 21.8 0 0 0 0 118 39083 0.16667 21.6 0 0 0 0 104 39083 0.20833 21.7 7 0 0 7 91 39083 0.25 22.2 81 59 2 84 77 39083 0.29167 23.6 183 205 7 190 64 39083 0.33333 25 311 319 0 311 51 39083 0.375 26 457 324 0 457 39 39083 0.41667 27 536 346 0 536 31 39083 0.45833 27.6 566 362 0 566 28 39083 0.5 27.6 506 276 0 506 32 39083 0.54167 27.5 361 242 0 361 41 39083 0.58333 27.2 313 210 0 313 53 39083 0.625 26.6 209 173 12 221 65
T = table2timetable(T)
Error using table2timetable
Input table must contain datetime or duration vector for row times.
Time =datetime(T.Time, "ConverFrom", "datenum", "Format", "HH:mm:ss");
Date =datetime(T.Date, "ConverFrom", "datenum", "Format", "dd/MM/yyyy");
TD = mergevars(T,{"Date","Time"},...
"NewVariableName","DateTime", "MergeAsTable",true);
I get error message when I try table2timetable and also when I try to merge Time and Date
How do I fix this please.
  댓글 수: 1
Mathieu NOE
Mathieu NOE 2023년 5월 24일
hi
it would be helpfull to share your excel file as well

댓글을 달려면 로그인하십시오.

답변 (1개)

Luca Ferro
Luca Ferro 2023년 5월 24일
  댓글 수: 4
MBUNYA NERVILLE ANYANG
MBUNYA NERVILLE ANYANG 2023년 5월 24일
The file is on path
Mathieu NOE
Mathieu NOE 2023년 5월 25일
make sure you have read / write permission on your path
are you sure you are not working in a windows protected path ?

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Spreadsheets에 대해 자세히 알아보기

제품


릴리스

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by