MATLAB: Changing minutes after midnight into a datetime array

daytime array

Suppose you have the matrix minutesaftermid which contains integers that represent the minutes after midnight, e.g. 1,2,3,4,5,6,7,……
How do I convert this format to a datetime array.
t = datetime(Y,M,D,H,MI,S,MS), but I only needs the MI.

Best Answer

"but I only need the MI" I don't think you can avoid the date and time.
X = 60*[1,2,3,4,5,6,7];
T = datetime( X, 'ConvertFrom','epochtime', 'Epoch','2000-01-01' )
T =
Columns 1 through 4
2000-01-01 00:01:00 2000-01-01 00:02:00 2000-01-01 00:03:00 2000-01-01 00:04:00
Columns 5 through 7
2000-01-01 00:05:00 2000-01-01 00:06:00 2000-01-01 00:07:00
and
>> T.Minute
ans =
1 2 3 4 5 6 7
Remark: the year 2000 is a leap year.