Importing time values into matlab in format hh:mm without converting to demical

1 次查看(过去 30 天)
Hello,
How can you import time values in the format hh:mm (i.e. 09:31 21:13) in a text file into matlab?
When I load like them in using this command, they get converted to decimal.
time=load('time.txt');
I also would like to plot a histogram of them.
Many thanks
John
  2 个评论
per isakson
per isakson 2012-2-11
Does the file consist of *one* line with *many* character strings of the format "hh:ss", which are separated by *one* space?
John
John 2012-2-12
Hello,
The file is a text file consisting of one one column of 'time' values like this:
10:43
08:23
19:56
20:29
01:33
Thank you for the help

请先登录,再进行评论。

回答(1 个)

Walter Roberson
Walter Roberson 2012-2-11
Do not use load() for this.
I do not know if importdata will work.
You can use textscan()
  4 个评论
Walter Roberson
Walter Roberson 2012-2-11
We would need to know the format of the lines in order to show you the textscan() format. The link Elige posted should give you some ideas.
John
John 2012-2-12
Hello,
I looked at that link but that poster was importing dates and time and some other date, I just have times.
The times are all in one column in this format
12:57:00
15:19:00
08:07:00
10:36:00
I'm sorry if it an easy question but I just don't know what to type.
Thank you

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Data Import and Export 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by