How do I read in an Excel Spreadsheet with these types of numbers?

1 view (last 30 days)
I need to read in an excel spreadsheet:
xlsread('fileID');
Each row of the spreadsheet looks like this:
1 49:33.2 10:49:32 0.20645 0.14044
Once read in it is displayed like this:
1 0.2844 0.451 0.20645 0.14044
How can I get it to read in columns two and three the way it appears in excel?

Accepted Answer

John Petersen
John Petersen on 22 May 2013
I get a different answer
1.0000 0.0344 0.4511 0.2064 0.1404
What matlab appears to be doing is interpreting the columns with colons as time with units in number of days. The first number 49:33 is interpreted as 49min 33s and converts to about 0.0344days The second time 10hrs, 49min, 32 sec, is about 0.45days. You'll just have to convert them back to time format in matlab.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!