How to add hours:minutes in Matlab?

2 visualizaciones (últimos 30 días)
Tahariet Sharon
Tahariet Sharon el 28 de En. de 2021
Comentada: Tahariet Sharon el 28 de En. de 2021
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!

Respuesta aceptada

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

Iniciar sesión para comentar.

Más respuestas (1)

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

Iniciar sesión para comentar.

Categorías

Más información sobre Data Type Conversion en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by