annotate toolboxes/bioakustik_tools/conversion/s_to_hhmmss.m @ 0:e9a9cd732c1e tip

first hg version after svn
author wolffd
date Tue, 10 Feb 2015 15:05:51 +0000
parents
children
rev   line source
wolffd@0 1 function out = s_to_hhmmss(in)
wolffd@0 2 %input: time in s (integer)
wolffd@0 3 %output: string in hhmmss format
wolffd@0 4
wolffd@0 5 hours = div(in,3600);
wolffd@0 6 mins = div(mod(in,3600),60);
wolffd@0 7 secs = mod(in,60);
wolffd@0 8
wolffd@0 9 out = strcat(tostr(hours),tostr(mins),tostr(secs));
wolffd@0 10
wolffd@0 11
wolffd@0 12 function u=tostr(v)
wolffd@0 13 if(v<10)
wolffd@0 14 u=sprintf('0%d',v);
wolffd@0 15 else
wolffd@0 16 u=sprintf('%d',v);
wolffd@0 17 end
wolffd@0 18
wolffd@0 19 function u=div(v,w)
wolffd@0 20 u=(floor(v/w));