You are right, it's confusing and it's because Excel stores its serial date number internally and shows it on a format chosen by the user. The internal value is shown when the user chose "No specific format". xlsread reads the internal value regardless of what is displayed.
The string 00:15:00 in the cell does not tell whether the underlying value is
- a character string, which is displayed with the format General or
- a serial date number, which is displayed with the format Time
Remains the question of how to convert Excel date and time to Matlab. I have long stopped using Excel and forgotten how to make this conversion.
Maybe the new function readtable fixes it automagically.
Guess that the numbers you see are in the unit "day" and make a test
>> 0.0104166666666667 * (24*60)
ans =
15.0000
>> datestr( 0.0104166666666667, 'HH:MM:SS' )
ans =
00:15:00
Indeed they are. Multiply by 24 to get hours or by (24*60) to get minutes.
However, it becomes more tricky when it comes to dates.
This has been ask several times, e.g
@Kian Azami points at datetime, which was "Introduced in R2014b". Thus, the short answer regarding dates is >> t = datetime( 0.0104166666666667,'ConvertFrom','excel')
t =
1899-12-31 00:15:00