Import hours from a excel file

조회 수: 1 (최근 30일)
stelios loizidis
stelios loizidis 2020년 12월 22일
편집: per isakson 2020년 12월 22일
Hello, in a excel file I have 24 values in the first column and in the second column I have the corresponding hours (format of hours: 00:00:00, 01:00:00, .... 22:00:00, 23:00:00). The problem I have is that I can not insert the column with the hours in the code so I can draw the graph for the 24 values with the corresponding time. How is this done? Your help is invaluable.
  댓글 수: 1
Mario Malic
Mario Malic 2020년 12월 22일
Hey,
Try using importtool and import your time data as datetime type. See here for more https://www.mathworks.com/help/matlab/matlab_prog/plot-dates-and-durations.html

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

답변 (1개)

per isakson
per isakson 2020년 12월 22일
편집: per isakson 2020년 12월 22일
It can be done with https://se.mathworks.com/help/matlab/ref/duration.html. , but that requires more reading of the documentation. IMO: This simpler
T = readtable('stelios.xlsx');
h = 24*T.time % Obviously, T.time is in days
plot( h, T.data )
where stelios.xlsx
I flipped the columns by mistake, because I'm used to date-time first.

카테고리

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