How to seperate weekdays and weekends from an hourly data?

1 回表示 (過去 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,:);
  1 件のコメント
Steph
Steph 2019 年 2 月 6 日
this approach works, need to change Frid to Fri only

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeData Type Conversion についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by