필터 지우기
필터 지우기

Hello, everyone, i have the following problem

조회 수: 1 (최근 30일)
Sascha  Winter
Sascha Winter 2016년 10월 6일
댓글: Sascha Winter 2016년 10월 7일
I have two data sets. One containing of dates from 1994-2016 where the weekends are already exluded and one with some dates of meetings (176 meetings) in this time-period. Now I have to construct eight Week-Dummies (from week -1 to week 6).
For example week 0 is defined as day -1 to day +3 where day 0 is the day of the meeting. I wanted to work with the function ismember, as in the example below. My problem is that sometimes date_num + i brings me to a weekend day which is not included in the data set and therefore MATLAB values it as a zero, but I need to give a command that it jumps to the next date which is included in the data set.
%week 0
FOMC_DUMMY_w0m1 = ismember(date_num,event_date_num - 1);
FOMC_DUMMY_w00 = ismember(date_num,event_date_num);
FOMC_DUMMY_w0p1 = ismember(date_num,event_date_num + 1);
FOMC_DUMMY_w0p2 = ismember(date_num,event_date_num + 2);
FOMC_DUMMY_w0p3 = ismember(date_num,event_date_num + 3);
FOMC_DUMMY_0 = [FOMC_DUMMY_w0m1 FOMC_DUMMY_w00 FOMC_DUMMY_w0p1 FOMC_DUMMY_w0p2 FOMC_DUMMY_w0p3];
FOMC_DUMMY_w0neu = sum(FOMC_DUMMY_0,2);
I hope you get my problem and I thank you all in advance for your answers

채택된 답변

Marc Jakobi
Marc Jakobi 2016년 10월 6일
I assume your date_num values are datenums?
How about something like:
wd = weekday(date_num + i);
if wd == 1
i = i + 1;
elseif wd == 7
i = i + 2;
end
  댓글 수: 1
Sascha  Winter
Sascha Winter 2016년 10월 7일
First thank you for your answer, i also thought about something like this but the problem is that there are several weekdays where there was no tradin dday so these days are also not part of the data set.
I fortunately got help with a different possibility to solve the problem.

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Calendar에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by