How to seperate weekdays and weekends from an hourly data?

조회 수: 2 (최근 30일)
Mahavir Nakum
Mahavir Nakum 2018년 3월 17일
댓글: Steph 2019년 2월 6일
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

답변 (1개)

Von Duesenberg
Von Duesenberg 2018년 3월 17일
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,:);

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by