Aggregate data using any number of multiple columns (Scripts) Publisher's description
from Jeff Burkey
Surprisingly, I never came across the simple solution of aggregating data using accumarray
Surprisingly, I never came across the simple solution of aggregating data using accumarray. Accumarray needs indices supplied to aggregate too. Combining this with the Unique function, the user can quickly and conveniently aggregate data using any available and appropriate funciton supported by Accumarray. The indices are created using the unique function.
This function is especially useful for aggregating timeseries of data say from hourly to daily, monthly, seasonal, etc. Like summing up precipitation, or averaging flow rates, etc.
Expected inputs is a timeseries of data with all but the last column used for generate unique combinations, and the last column is what the summarization is done on.
Additionally, I wrote a similar function (accumSeasonTS.m) aggregating data to seasons as defined by the solstices and equinoxes when given two columns of data: serial date and associated data values.
datain = r x c
fn = supplied string specifying a valid summary statistic function.
Example: @sum, @max, @min, etc.
dataout = r x c
King County- DNRP
June 9, 2009
[dataout] = accumTS(datain,fn)
d = accumTS(din,@max);
System Requirements:MATLAB 7.8 (R2009a)
Program Release Status: New Release
Program Install Support: Install and Uninstall