Working and non Working hours

3 次查看(过去 30 天)
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.

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Dates and Time 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by