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 ExchangeData Type Conversion についてさらに検索

質問済み:

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