There are plenty of ways of doing this which does not require loops.
If you did not require the index of the max, the simplest would be to use the retime method of a timetable object: loggeddata = readtable('sample.csv');
loggeddata.Properties.VariableNames = {'AcquisitionTime', 'OxygenConcentration'};
loggeddata = table2timetable(loggeddata);
dailymax = retime(loggeddata, 'daily', 'max');
If you want the index of the max, then discretize and splitapply are probably the best tools. You don't need to convert to a timetable (you may still want to) for that: loggeddata = readtable('sample.csv');
loggeddata.Properties.VariableNames = {'AcquisitionTime', 'OxygenConcentration'};
loggeddata = table2timetable(loggeddata);
[group, date] = discretize(loggeddata.AcquisitionTime, 'day');
[maxconc, row] = splitapply(@max, loggeddata, group);
dailymax = timetable(maxconc, loggeddata.AcquisitionTime(row), 'RowTimes', date(1:end-1), 'VariableName', {'MaxConcentration', 'ActualTime'})
Best Answer