For Loop-Specific Dates

I want to do rolling window regression between specific dates, for example, from 31.01.2015-28.02.2015 then 28.02.2015-31.03.2015.. etc. (between end of the days of every month).
My dataset's first column consists of dates (with serial numbers format in Matlab)
How can I write the code?
Thank you very much,

回答 (3 件)

Andrei Bobrov
Andrei Bobrov 2016 年 10 月 2 日
編集済み: Andrei Bobrov 2016 年 10 月 2 日

1 投票

dte = datenum(2015,1,(1:sum(yeardays(2002:2015)))');
[~,~,dv] = datevec(dte);
t = dv == 1;
ii = cumsum([t(2:end);0]);

2 件のコメント

meral serçe
meral serçe 2016 年 10 月 2 日
Thank you very much for your answer
How can I integrate this code to a rolling window regression and for other dates like 2002,2003,2004..etc.?
Andrei Bobrov
Andrei Bobrov 2016 年 10 月 2 日
I corrected code.

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

meral serçe
meral serçe 2016 年 10 月 2 日

0 投票

Thank you very much for your answer
How can I integrate this code to a rolling window regression and for other dates like 2002,2003,2004..etc.?

1 件のコメント

meral serçe
meral serçe 2016 年 10 月 2 日
Perfect, also could you write this code with integrating rolling window regression? I mean, integrating this code to a ,regress (Y,X) , with rolling regression (from the end of the day of specific month to other month)
Thank you very much,

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

meral serçe
meral serçe 2016 年 10 月 2 日

0 投票

I mean, integrating this code to a ,
regress (Y,X) , with rolling regression (from the end of the day of specific month to other month)
Thank you very much,

カテゴリ

タグ

質問済み:

2016 年 10 月 2 日

コメント済み:

2016 年 10 月 2 日

Community Treasure Hunt

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

Start Hunting!

Translated by