How to seperate weekdays and weekends from an hourly data?

5 visualizaciones (últimos 30 días)
Mahavir Nakum
Mahavir Nakum el 17 de Mzo. de 2018
Comentada: Steph el 6 de Feb. de 2019
I have a data in excel which has data in yyyy-mm-dd hr:min:sec Am/PM format and I want to separate this data to weekdays and weekends without doing any average of it. How do I do it?
Thank Mahavir

Respuestas (1)

Von Duesenberg
Von Duesenberg el 17 de Mzo. de 2018
Here's what I do (byHourTable is a timetable object with a column called Timestamps):
%get day names
[~, dayNames] = weekday(byHourTable.Timestamps, 'short');
%find indices of week days
indWorkDay = ismember(dayNames, {'Mon', 'Tue', 'Wed', 'Thu', 'Frid'});
%extract data for week days only
aggrDay = byHourTable(indWorkDay,:);

Categorías

Más información sobre Tables en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by