One of my own, simple matlab code to go from seconds to hh:mm:ss, this program works with a vector of values and maybe a matrix. I've not bothered with making a read in fuction since matlab codes work from plain text files but one could be added very easily.
Quote
t = 3661;
%Choose your t values, use [value1, value2, value3, ..., valueN] for a vector of values
a = rem(t,3600);
%Gets remainder when we remove hours
hh = (t-a)/3600;
%Gives hh in hours
t = t - hh*3600;
%Removes hours from t
a = rem(t,60);
%Gets remainder when we remove minutes
mm = (t-a)/60;
%Gives mm in mins
ss = t - mm*60
%Finds the seconds
disp(hh)
disp(mm)
disp(ss)
%Outputs the hh:mm:ss as a series of three values over each other.
%Choose your t values, use [value1, value2, value3, ..., valueN] for a vector of values
a = rem(t,3600);
%Gets remainder when we remove hours
hh = (t-a)/3600;
%Gives hh in hours
t = t - hh*3600;
%Removes hours from t
a = rem(t,60);
%Gets remainder when we remove minutes
mm = (t-a)/60;
%Gives mm in mins
ss = t - mm*60
%Finds the seconds
disp(hh)
disp(mm)
disp(ss)
%Outputs the hh:mm:ss as a series of three values over each other.
This code can be expanded for any time unit.
Edit: Bug spotted by JNengland77, stupid mornings hurting my coding skills
Post your own and it might help someone.
Edited by Dauth, 18 June 2009 - 23:49.