How to convert dates to numbers in Matlab

Posted by user1297712 on Stack Overflow See other posts from Stack Overflow or by user1297712
Published on 2012-03-29T17:26:23Z Indexed on 2012/03/29 17:29 UTC
Read the original article Hit count: 158

Filed under:
|
|
|

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.

© Stack Overflow or respective owner

Related posts about matlab

Related posts about time