Aggregate data using any number of multiple columns

버전 1.2.0.0 (1.42 KB) 작성자: Jeff Burkey
Using two of Matlabs functions, unique and accumarray, this function summarizes any number of cols.
다운로드 수: 1.6K
업데이트 날짜: 2009/10/14

라이선스 보기

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

Written by:
Jeff Burkey
King County- DNRP
email: jeff.burkey@kingcounty.gov
June 9, 2009

Syntax:
[dataout] = accumTS(datain,fn)
Example:
d = accumTS(din,@max);

인용 양식

Jeff Burkey (2024). Aggregate data using any number of multiple columns (https://www.mathworks.com/matlabcentral/fileexchange/24391-aggregate-data-using-any-number-of-multiple-columns), MATLAB Central File Exchange. 검색됨 .

MATLAB 릴리스 호환 정보
개발 환경: R2009a
모든 릴리스와 호환
플랫폼 호환성
Windows macOS Linux
카테고리
Help CenterMATLAB Answers에서 Tables에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
버전 게시됨 릴리스 정보
1.2.0.0

Updated comments.

1.1.0.0

Changed online text.

1.0.0.0