SEC2HMS Convert seconds into hms format. [H,M,S] = SEC2HMS(SEC) converts value SEC in unit seconds into hours H, minutes M and seconds S. $Id: sec2hms.m,v 1.1 2004/05/15 21:59:56 dalai Exp $
0001 %SEC2HMS Convert seconds into hms format. 0002 % [H,M,S] = SEC2HMS(SEC) converts value SEC in unit seconds 0003 % into hours H, minutes M and seconds S. 0004 % $Id: sec2hms.m,v 1.1 2004/05/15 21:59:56 dalai Exp $ 0005 0006 function [h,m,s]=sec2hms(x) 0007 0008 h=fix(x/3600); 0009 rest=x-3600*h; 0010 m=fix(rest/60); 0011 s=fix(rest-60*m); 0012 if nargout<3 0013 h(2)=m; 0014 h(3)=s; 0015 end