MATLAB: Efficiently find duplicate values and then average other value in rows and remove extra rows

duplicate valuematrix manipulationremove rows

I have data that sometimes has more than one measurement for a single date. I would like to interpolate the data, so I need to create single values for each date. I would like to do this by finding duplicate dates, averaging the data value for the date, and then replacing the original rows with the new single row. How to do this?
For example (made up data):
Starting data:
[2009.02, 120;
2009.14, 150;
2009.14, 190;
2009.24, 70;
2009.34, 80;
2009.52, 90;
2009.52, 150;
2009.52, 60]
Would become:
[2009.02, 120;
2009.14, 170;
2009.24, 70;
2009.34, 80;
2009.52, 100]
Thank you!

Best Answer

Tailor-made problem for the accumarray() function:
A = [2009.02, 120;
2009.14, 150;
2009.14, 190;
2009.24, 70;
2009.34, 80;
2009.52, 90;
2009.52, 150;
2009.52, 60];
[UA,~,idx] = unique(A(:,1));
NEW_A = [UA,accumarray(idx,A(:,2),[],@mean)]