Working and non Working hours

4 visualizaciones (últimos 30 días)
Tushar Agarwal
Tushar Agarwal el 3 de Oct. de 2016
Comentada: Tushar Agarwal el 6 de Oct. de 2016
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?

Respuesta aceptada

Jan Orwat
Jan Orwat el 3 de Oct. de 2016
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 comentarios
Steven Lord
Steven Lord el 5 de Oct. de 2016
Use the day function with the 'dayofweek' option.
Tushar Agarwal
Tushar Agarwal el 6 de Oct. de 2016
Thanks guys.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Dates and Time en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by