Importing excel time data
이전 댓글 표시
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 = table2timetable(T)
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
2023년 5월 24일
hi
it would be helpfull to share your excel file as well
답변 (1개)
Luca Ferro
2023년 5월 24일
0 개 추천
I think you can find your solution here https://it.mathworks.com/matlabcentral/answers/25216-reading-time-dates-from-excel
댓글 수: 4
Luca Ferro
2023년 5월 24일
make sure that the LW.xlsx file is on matlab path
MBUNYA NERVILLE ANYANG
2023년 5월 24일
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 ?
카테고리
도움말 센터 및 File Exchange에서 Spreadsheets에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!