%% timfh2hms.m converts time from fractional hours to hours,
%% minutes and seconds (rounded to the nearest second).
%%

function [hrmat,mnmat,scmat]=timfh2hms(timmat)

% timmmat = fractional hours matrix
% hrmat = hours matrix
% mnmat = minutes matrix
% scmat = second matrix

hrmat=floor(timmat);                    %hours matrix
fmn=60*(timmat-hrmat);                  %fractional minutes and seconds in minutes
mnmat=floor(fmn);                       %minutes matrix
scmat=round(60*(fmn-mnmat));            %seconds matrix
