Import hours from a excel file

1 view (last 30 days)
stelios loizidis
stelios loizidis on 22 Dec 2020
Edited: per isakson on 22 Dec 2020
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 Comment
Mario Malic
Mario Malic on 22 Dec 2020
Try using importtool and import your time data as datetime type. See here for more

Sign in to comment.

Answers (1)

per isakson
per isakson on 22 Dec 2020
Edited: per isakson on 22 Dec 2020
It can be done with , 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, )
where stelios.xlsx
I flipped the columns by mistake, because I'm used to date-time first.

Community Treasure Hunt

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

Start Hunting!