www.gusucode.com > matlab 案例源码 matlab代码程序 > matlab/DetermineDayOfWeekExample.m

    %% Determine Day of Week
%%
% Determine the day of the week for an arbitrary date, by specifying
% |'name'| as the second input to the |day| function.

% Copyright 2015 The MathWorks, Inc.

t = datetime(2014,05,16)
%%
d = day(t,'name')
%%
% Alternatively, specify |'dayofweek'| to return the day of the week as a
% number.
d = day(t,'dayofweek')