%function str = sec2str(seconds)
function str = sec2str(seconds)

hours = floor(seconds/3600);
remainder = seconds-hours*3600;
minutes = floor(remainder/60);
remainder = seconds-hours*3600-minutes*60;
seconds = floor(remainder);

hstr = int2str(hours);
if length(hstr) < 2, hstr = ['0' hstr]; end
mstr = int2str(minutes);
if length(mstr) < 2, mstr = ['0' mstr]; end
sstr = num2str(remainder);
if length(int2str(seconds)) < 2, sstr = ['0' sstr]; end

str = [ hstr ':' mstr ':' sstr];
