Importing time values into matlab in format hh:mm without converting to demical
Show older comments
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 Comments
per isakson
on 11 Feb 2012
Does the file consist of *one* line with *many* character strings of the format "hh:ss", which are separated by *one* space?
John
on 12 Feb 2012
Answers (1)
Walter Roberson
on 11 Feb 2012
0 votes
Do not use load() for this.
I do not know if importdata will work.
You can use textscan()
4 Comments
Dr. Seis
on 11 Feb 2012
Your answer here might be useful: http://www.mathworks.com/matlabcentral/answers/24523-reading-dates-and-time
John
on 11 Feb 2012
Walter Roberson
on 11 Feb 2012
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
on 12 Feb 2012
Categories
Find more on Text Files in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!