How to add hours:minutes in Matlab?

조회 수: 2 (최근 30일)
Tahariet Sharon
Tahariet Sharon 2021년 1월 28일
댓글: Tahariet Sharon 2021년 1월 28일
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