Presuming this is in a timetable from the timeseries in Trading TB, retime is one way to apply a function.
Alternatively, findgroups and splitapply for table object or findgroups and process each group via loop or arrayfun if loose data in array.
Try timetable instead...
The sample data has many hours with no data and retime will infill those; easy as any is to just go ahead and then remove those from end result. That may not be an issue with the full file I suspect...
DATETIME A1 A2 A3 A4
__________________________ ______ ______ ______ ______
12/31/2009 12:00:00.000 AM 1094.2 1093.7 1093.8 107.16
1/1/2010 12:00:00.000 AM 1095.5 1094.9 1095.1 107.23
COMMENT It's actually 'daily' that was wanted, so the infill problem goes away for it...
Well, some of the new stuff is quite handy but, there are some other ways to skin the cat with earlier stuff that came along with the datetime class...in particular, one I tend to forget with retime is dateshift; it'll do the job quite neatly...
Now use splitapply with g as grouping variable.