Next or previous business day
Busday = busdate(Date, DirFlag, Holiday, Weekend)
Reference date. Enter scalar, vector, or matrix of reference business dates as serial date numbers or date strings.
(Optional) String or cell array of strings of business day convention with possible values: follow (default), modifiedfollow, previous, modifiedprevious. Also, DirFlag may be a scalar, vector, or matrix of search directions, where Next is DIREC = 1 (default) or Previous is DIREC = -1.
(Optional) Vector of holidays and nontrading-day dates. All dates in Holiday must be the same format: either serial date numbers or date strings. (Using serial date numbers improves performance.) If Holiday is not specified, the non-trading day default vector is determined by the routine holidays function.
(Optional) Vector of length 7, containing 0 and 1, the value 1 indicating weekend days. The first element of this vector corresponds to Sunday. Thus, when Saturday and Sunday form the weekend (default), Weekend = [1 0 0 0 0 0 1].
Busday = busdate(Date, DirFlag, Holiday, Weekend) returns the scalar, vector, or matrix of the next or previous business day(s), depending on Holiday.
Use the function datestr to convert serial date numbers to formatted date strings.
Busday = busdate('3-Jul-2001', 1)
Busday = 731037
ans = 05-Jul-2001
Example 2. You can indicate that Saturday is a business day by appropriately setting the Weekend argument.
Weekend = [1 0 0 0 0 0 0];
July 4, 2003 falls on a Friday. Use busdate to verify that Saturday, July 5, is actually a business day.
Date = datestr(busdate('3-Jul-2003', 1, , Weekend))