Selecting Mondays from a Timetable or Table using the datetime object

5 次查看(过去 30 天)
Hi,
I would like to write a script that scrolls through my five minutes resolved timetable / table to select identifies all the days that are Mondays and then group them based on the datetime variable of the table/timetable.
I have tried several other ways to do it including the one below. Instead, if I specify the the day as 1, it returns all the first days of the periods (in this case months) and not specifically the Mondays.
Day1=HHB1(1==day(HHB1.VarName1),:); % HHB1 is the datetime object
%%
Any help?

采纳的回答

Stephen23
Stephen23 2022-3-8
编辑:Stephen23 2022-3-8
By default DAY returns the day of the month, so you need to specify its second argument like this:
d = day(t,'dayofweek')
  4 个评论

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Data Type Identification 的更多信息

产品


版本

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by