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

    %% Round Duration Values Toward Negative Infinity
%%
% Round each value in a |duration| array to the nearest number of
% seconds less than or equal to that value.

% Copyright 2015 The MathWorks, Inc.

t = hours(8) + minutes(29:31) + seconds(1.23);
t.Format = 'hh:mm:ss.SS'
%%
Y1 = floor(t)
%%
% Round each value in |t| to the nearest number of hours less than or
% equal to that value.
Y2 = floor(t,'hours')