필터 지우기
필터 지우기

How do I read (hours) data from the .xlsx file?

조회 수: 2 (최근 30일)
stelios loizidis
stelios loizidis 2021년 2월 10일
댓글: stelios loizidis 2021년 2월 10일
Hello,
I have the following issue. In a .xlsx file I have in column D hours (format: 00: 00: 00,01: 00: 00, ... 23:00:00). How can I integrate (read) them into the code to use them to plot some graphics I want. Your help is important.

채택된 답변

Walter Roberson
Walter Roberson 2021년 2월 10일
[~,~,ALL_Data]=xlsread('Hours_Data.xlsx');
Hours = days(cell2mat(ALL_Data(2:25,end)));
Hours.Format = 'hh:mm';
Hours
Hours = 24×1 duration array
00:00 01:00 02:00 03:00 04:00 05:00 06:00 07:00 08:00 09:00 10:00 11:00 12:00 13:00 14:00 15:00 16:00 17:00 18:00 19:00 20:00 21:00 22:00 23:00
%OR
ALL_Data = readtable('Hours_Data.xlsx');
Hours = days(ALL_Data{:,end});
Hours.Format = 'hh:mm';
Hours
Hours = 24×1 duration array
00:00 01:00 02:00 03:00 04:00 05:00 06:00 07:00 08:00 09:00 10:00 11:00 12:00 13:00 14:00 15:00 16:00 17:00 18:00 19:00 20:00 21:00 22:00 23:00
  댓글 수: 1
stelios loizidis
stelios loizidis 2021년 2월 10일
It works. Thank you very much for the valuable help !!!

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

추가 답변 (1개)

KSSV
KSSV 2021년 2월 10일
Read about readtable. In here after reading your specify the format of time. Have a look on duration.
  댓글 수: 7
Walter Roberson
Walter Roberson 2021년 2월 10일
If the answer is NO, that you have technical problems or legal restrictions that prevent you from uploading a small sample file, then just say so, and we will provide additional steps to figure out exactly what is happening. But if you were hoping for an answer soon and there is no technical or legal restriction to uploading a small sample file then upload a small sample file
We. Need. To. See. Exactly. What. Is. Stored. In. The. File.
Not what an image of it looks like. Excel permits many different kinds of data to be displayed as the same thing.
stelios loizidis
stelios loizidis 2021년 2월 10일
Attach the file

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

카테고리

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

태그

Community Treasure Hunt

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

Start Hunting!

Translated by