www.gusucode.com > matlab 案例源码 matlab代码程序 > matlab/RoundDurationValuesExample.m
%% Round Duration Values %% % Round each value in a duration array to the nearest number of % seconds. % Copyright 2015 The MathWorks, Inc. t = hours(8) + minutes(29:31) + seconds(1.3:0.5:2.3); t.Format = 'hh:mm:ss.SS' %% Y1 = round(t) %% % Round each value in t to the nearest number of hours. Y2 = round(t,'hours')