フィルターのクリア

How to take monthly average from table?

4 ビュー (過去 30 日間)
Keegan Carvalho
Keegan Carvalho 2022 年 4 月 16 日
回答済み: KSSV 2022 年 4 月 16 日
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.

回答 (1 件)

KSSV
KSSV 2022 年 4 月 16 日

カテゴリ

Help Center および File ExchangeSpreadsheets についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by