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

    %% Convert Durations to Numeric Array of Seconds
%%
% Create a |duration| array.

% Copyright 2015 The MathWorks, Inc.

X = hours(1) + minutes(1:4)
%%
% Convert each duration in |X| to a number of seconds.
S = seconds(X)
%%
% |S| is a |double| array.
%%
% Find the natural logarithm of |S|. The |log| function accepts inputs of
% type |double|.
Y = log(S)