time2sec.m
来自「matlab处理图像的一些基本方法。其中有一部分mex程序需要安装编译」· M 代码 · 共 53 行
M
53 行
function S=time2sec(t)%TIME2SEC Converts the time in seconds.%% S = TIME2SEC(TIME)%% TIME can be a string in the format 'hh:mm:ss'% or a vector of 3 elements [hh mm ss].% Return the number of seconds.%% See also: SEC2TIME TIME CLOCK TIC TOC ETIME%% Claudio 7 June 1995.%%%% Copyright (c) 1995 by Claudio Rivetti and Mark Young% claudio@alice.uoregon.edu, mark@alice.uoregon.edu%if nargin < 1 error('Not enough input arguments.');endif nargin > 1 error('Too many input arguments.');endif isstr(t) if length(t) ~=8 | t(3)~=':' | t(6)~=':' error('Input string must be in the format hh:mm:ss'); endelse if length(t) ~= 3 error('Input vector must contein 3 elements [hh, mm, ss]'); endendif isstr(t) h=str2num(t(1:2)); m=str2num(t(4:5)); s=str2num(t(7:8));else h=t(1); m=t(2); s=t(3);endS = s + m*60 + h*3600;return
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?