datetime.isweekend
datetime: TF = isweekend (T)
Determine which datetime values fall on a weekend.
TF = isweekend (T) returns a logical array TF of
the same size as the input datetime array T, where each element is
true if the corresponding datetime falls on a Saturday or Sunday,
and false otherwise. Not-A-Time (NaT) values return
false.
Source Code: datetime
isweekend is true on Saturdays and Sundays. Here a run from Friday to Monday flags only the two middle days.
t = datetime (2024, 3, 8) : caldays (1) : datetime (2024, 3, 11)
t =
1x4 datetime array
08-Mar-2024 09-Mar-2024 10-Mar-2024 11-Mar-2024
isweekend (t)
ans = 0 1 1 0