How to convert dates to numbers in Matlab
- by user1297712
I have some variables like these:
a(1)=00:26:00
a(2)=744:32:00
a(3)=8040:33:00
I want to convert them to numbers, so I use the datenum command.
The biggest number should be 8040:33:00, but look what happens.
datenum(a([1 2 3]))
ans =
1.0e+005 *
7.3487
7.3485
7.3486
But if I don´t calculate a(1):
datenum(a([2 3],51))
ans =
1.0e+005 *
7.3490
7.3520
That´s the results that I want to get. I think that the problem is that a(2) and a(3) have more than 24hours but I haven´t found any way to solve this problem.
Thanks.