Convert daily data to monthly data with missing values.

Hello everyone,
Suppose that I have a daily data but missing some dates as follows. How can I conver the series to a monthly time series. The monthly value is the average daily data available for each month.
29/12/1989 100
04/01/1990 200
05/01/1990 130
01/02/1990 125
09/02/1990 133
12/02/1990 135
Many thanks,
Bao

 채택된 답변

KSSV
KSSV 2022년 5월 18일

0 개 추천

You can fill the missing values using fillmissing. You can resample the data using retime

댓글 수: 1

Bao Nguyen
Bao Nguyen 2022년 5월 19일
편집: KSSV 2022년 5월 19일
Thanks,
Finally, there are a few steps to get the monthly data:
TT = readtimetable('data.csv'); %loading your data
tt = retime(TT, 'daily'); % or
%tt = retime(TT, 'daily', 'previous'); % replace all missing entries with the value from the previous entry.
sum = retime(tt,'Monthly','Sum');
average = retime(tt,'Monthly','mean');

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Time Series Objects에 대해 자세히 알아보기

질문:

2022년 5월 18일

편집:

2022년 5월 19일

Community Treasure Hunt

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

Start Hunting!

Translated by