Oliver, it's not 100% clear what you have, but I think this will do what you want. The main issue is, I guess, that your spreadsheet is formatted kind of funny, with no date info at all. I'm showing this done in raw workspace variables, but I actually recommend that you use readtable and work in the table you get back.
>> timestamps = repmat([0 43200]'/86400,3,1)
timestamps =
0
0.5000
0
0.5000
0
0.5000
>> t = datetime(timestamps,'ConvertFrom','Excel')
t =
6×1 datetime array
31-Dec-1899 00:00:00
31-Dec-1899 12:00:00
31-Dec-1899 00:00:00
31-Dec-1899 12:00:00
31-Dec-1899 00:00:00
31-Dec-1899 12:00:00
>> newday = [true; diff(t)<0]
newday =
6×1 logical array
1
0
1
0
1
0
>> daynum = cumsum(newday)
daynum =
1
1
2
2
3
3
>> date = datetime(2019,3,1) + caldays(daynum-1)
date =
6×1 datetime array
01-Mar-2019
01-Mar-2019
02-Mar-2019
02-Mar-2019
03-Mar-2019
03-Mar-2019
>> time = t - datetime(1899,12,31)
time =
6×1 duration array
00:00:00
12:00:00
00:00:00
12:00:00
00:00:00
12:00:00
>> dt = date + time
dt =
6×1 datetime array
01-Mar-2019 00:00:00
01-Mar-2019 12:00:00
02-Mar-2019 00:00:00
02-Mar-2019 12:00:00
03-Mar-2019 00:00:00
03-Mar-2019 12:00:00
Best Answer