How to add hours:minutes in Matlab?

1 次查看(过去 30 天)
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!

采纳的回答

Walter Roberson
Walter Roberson 2021-1-28
t='10:10';
minutes(duration(t, 'inputformat', 'hh:mm'))
ans = 610
  3 个评论
Walter Roberson
Walter Roberson 2021-1-28
If it is a cell array of character vectors, use the call I provided.
Tahariet Sharon
Tahariet Sharon 2021-1-28
Ok, t should be then a cell array. Got it! Thanks!

请先登录,再进行评论。

更多回答(1 个)

KSSV
KSSV 2021-1-28
t='10:10';
[Y, M, D, H, MN, S] = datevec(t);
H*60+MN
  1 个评论
Tahariet Sharon
Tahariet Sharon 2021-1-28
I have a 100x1000 matrix of hh:mm data. How to simoultaneously convert them all?

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Data Type Conversion 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by