How to split monthly value into days

8 ビュー (過去 30 日間)
Jan Koncel
Jan Koncel 2022 年 3 月 27 日
コメント済み: Jan Koncel 2022 年 3 月 28 日
Hello everyone
I have a little issue here. Solution must be easy, but i cant figure it out.
I have 12 values (each represent ideal rain in every month) IR = [0 0 0 70 83 100 110 100 70 0 0 0]'
Then i have long datetime (10 years) with daily time step.
Need to find out value for each day.
Example: IR for 27.Sept = IR(Sept)/number of days in Sept
Thanks for every help

採用された回答

Andrei Bobrov
Andrei Bobrov 2022 年 3 月 27 日
Let dates - your long datetime (10 years) with daily time step.
out = IR(month(dates))./day(dates,"dayofmonth")
  2 件のコメント
Jan Koncel
Jan Koncel 2022 年 3 月 28 日
I found way it works out for me, your advice was very useful, thanks
IR = [0 0 0 70 83 100 110 100 70 0 0 0]';
days_in_month = days(dateshift(Date,'end','month')-dateshift(Date,'start','month')+1);
IR_d = IR(month(Date))./days_in_month;

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Find more on Dates and Time in Help Center and File Exchange

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by