How to take monthly average from table?
조회 수: 3 (최근 30일)
이전 댓글 표시
Hi all!
I have an excel file (attached) - data.xlsx. The first column "date" has values stored as "yyyymmdd" format for each grid cell in a netcdf file. dur - duration and int-intensity.
Now I wanted to first convert those date values to month-year formats (eg. Jan - 1990, Feb - 1990...) and find the monthly average for "dur" and "mean". I started off with the following code, but ended up getting wrong values:
data=readtable("data.xlsx");
datar=datevec(num2str(data{1,:}),'yyyymmdd');
dv = datevec(data.date);
data.Year = dv(:,1);
data.Month = dv(:,2)
I've read about varfun, but I'm still working my way around this. Appreciate any help with my problem.
댓글 수: 0
답변 (1개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Dates and Time에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!