DAYOFWEEK Day of week. NUM = DAYOFWEEK(YEAR, MONTH, DAY, HOUR, MINUTE, SECOND) returns the ordinal day number in the given week plus a fractional part depending on the time of day. This function is ISO 8601 compliant, so Monday is day 1, Tuesday is day 2, ..., Sunday is day 7. If Monday is day 0, Tuesday is day 1, ..., Sunday is day 6, use num = dayofweek(...) - 1 If Sunday is day 1, Monday is day 2, ..., Saturday is day 7, use num = rem(dayofweek(...), 7) + 1 If Sunday is day 0, Monday is day 1, ..., Saturday is day 6, use num = rem(dayofweek(...), 7) Any missing MONTH or DAY will be replaced by ones. Any missing HOUR, MINUTE or SECOND will be replaced by zeros. If no date is specified, the current date is used. Gregorian calendar is assumed.

- date2mjd DATE2MJD Modified Julian day number.

- weekofyear WEEKOFYEAR Ordinal week number.
- weeksinyear WEEKSINYEAR Number of weeks in a year.

0001 function dow = dayofweek(varargin) 0002 %DAYOFWEEK Day of week. 0003 % 0004 % NUM = DAYOFWEEK(YEAR, MONTH, DAY, HOUR, MINUTE, SECOND) returns the 0005 % ordinal day number in the given week plus a fractional part depending on 0006 % the time of day. This function is ISO 8601 compliant, so Monday is day 0007 % 1, Tuesday is day 2, ..., Sunday is day 7. 0008 % 0009 % If Monday is day 0, Tuesday is day 1, ..., Sunday is day 6, use 0010 % 0011 % num = dayofweek(...) - 1 0012 % 0013 % If Sunday is day 1, Monday is day 2, ..., Saturday is day 7, use 0014 % 0015 % num = rem(dayofweek(...), 7) + 1 0016 % 0017 % If Sunday is day 0, Monday is day 1, ..., Saturday is day 6, use 0018 % 0019 % num = rem(dayofweek(...), 7) 0020 % 0021 % Any missing MONTH or DAY will be replaced by ones. Any missing HOUR, 0022 % MINUTE or SECOND will be replaced by zeros. 0023 % 0024 % If no date is specified, the current date is used. Gregorian calendar 0025 % is assumed. 0026 0027 % Author: Peter J. Acklam 0028 % Time-stamp: 2002-05-24 14:26:48 +0200 0029 % E-mail: pjacklam@online.no 0030 % URL: http://home.online.no/~pjacklam 0031 0032 error(nargchk(0, 6, nargin)); 0033 dow = 1 + mod(date2mjd(varargin{:}) + 2, 7);

Generated on Mon 15-Sep-2014 13:31:28 by