Working and non Working hours

조회 수: 1 (최근 30일)
Tushar Agarwal
Tushar Agarwal 2016년 10월 3일
댓글: Tushar Agarwal 2016년 10월 6일
Is there a way in which I can split my data with one column having datetime (day and hour) into working and non working hours?

채택된 답변

Jan Orwat
Jan Orwat 2016년 10월 3일
Yes, you can. For example:
% assuming your data in variable called datecolumn
daytime = timeofday(datecolumn);
openinghour = duration(09, 00, 00);
closinghour = duration(18, 00, 00);
isworkinghour = (openinghour <= daytime) & (daytime <= closinghour);
workinghours = datecolumn(isworkinghour);
nonworkinghours = datecolumn(~isworkinghour);
  댓글 수: 8
Steven Lord
Steven Lord 2016년 10월 5일
Use the day function with the 'dayofweek' option.
Tushar Agarwal
Tushar Agarwal 2016년 10월 6일
Thanks guys.

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

추가 답변 (0개)

카테고리

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

태그

Community Treasure Hunt

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

Start Hunting!

Translated by