Borrar filtros
Borrar filtros

How to take monthly average from table?

4 visualizaciones (últimos 30 días)
Keegan Carvalho
Keegan Carvalho el 16 de Abr. de 2022
Respondida: KSSV el 16 de Abr. de 2022
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.

Respuestas (1)

KSSV
KSSV el 16 de Abr. de 2022

Community Treasure Hunt

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

Start Hunting!

Translated by