Clear Filters
Clear Filters

Convert time

3 views (last 30 days)
Márcia Pereira
Márcia Pereira on 14 Mar 2012
Hi, I'm a student at university and I'd like to convert time to values usable by matlab to calculate some variables.
The values of time I have are in a xls. file and they're writen like this one 8:15 (a quarter ast eight). I tried replacing : by . but it only makes matlab read it like a decimal number 8,15.
What I want is to convert that to eight hours and fifteen minutes. I have to do it in matlab because there are too many values in the excel file.

Accepted Answer

Thomas
Thomas on 14 Mar 2012
You could try datestr,datenum
doc datestr
doc datenum
Eg. Suppose you have 8:15 in the text, xls file, import it as string
c='8:15';
datestr(c,'HH:MM')
ans =
08:15
or convert into datenum for further calculations..

More Answers (0)

Categories

Find more on Dates and Time 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!