How to add hours:minutes in Matlab?

Let's say I have hours:minute data in format HH:MM, and want to do statistics with it. I want to have the data in minutes for instance to be able to do t-tests. How to go about this in Matlab? Thanks!

 Accepted Answer

t='10:10';
minutes(duration(t, 'inputformat', 'hh:mm'))
ans = 610

3 Comments

I have a 100x1000 matrix of hh:mm data. How to simoultaneously convert them all?
If it is a cell array of character vectors, use the call I provided.
Ok, t should be then a cell array. Got it! Thanks!

Sign in to comment.

More Answers (1)

t='10:10';
[Y, M, D, H, MN, S] = datevec(t);
H*60+MN

1 Comment

I have a 100x1000 matrix of hh:mm data. How to simoultaneously convert them all?

Sign in to comment.

Categories

Find more on Functions in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!