if option with weekend and date serial number
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
AA
am 28 Nov. 2017
Beantwortet: Walter Roberson
am 28 Nov. 2017
I have a date serial number x. If the number is a weekend then x+3, if the number is not a weekend then x +1. how can i put this as code?
0 Kommentare
Akzeptierte Antwort
Walter Roberson
am 28 Nov. 2017
output = x + 1 + 2 * isweekend( datetime(x, 'convertfrom', 'datenum') );
or
output = x + 1 + 2 * ismember(weekday(x), [1 7]);
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Holidays / Seasons finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!