Mercurial > hg > smallbox
annotate util/ksvd utils/secs2hms.m @ 174:dc2f0fa21310 danieleb
multiple trials with error bars
author | Daniele Barchiesi <daniele.barchiesi@eecs.qmul.ac.uk> |
---|---|
date | Thu, 17 Nov 2011 11:16:15 +0000 |
parents | c3eca463202d |
children |
rev | line source |
---|---|
idamnjanovic@70 | 1 function [h,m,s] = secs2hms(t) |
idamnjanovic@70 | 2 %SECS2HMS Convert seconds to hours, minutes and seconds. |
idamnjanovic@70 | 3 % [H,M,S] = SECS2HMS(T) converts the specified number of seconds T to |
idamnjanovic@70 | 4 % hours, minutes and seconds. H and M are whole numbers, and S is real. |
idamnjanovic@70 | 5 % |
idamnjanovic@70 | 6 % Example: Estimate the remaining time of a loop |
idamnjanovic@70 | 7 % |
idamnjanovic@70 | 8 % n = 10; tic; |
idamnjanovic@70 | 9 % for i = 1:n |
idamnjanovic@70 | 10 % pause(1); |
idamnjanovic@70 | 11 % [h,m,s] = secs2hms( (n-i)*toc/i ); |
idamnjanovic@70 | 12 % printf('estimated remaining time: %02d:%02d:%05.2f',h,m,s); |
idamnjanovic@70 | 13 % end |
idamnjanovic@70 | 14 |
idamnjanovic@70 | 15 |
idamnjanovic@70 | 16 % Ron Rubinstein |
idamnjanovic@70 | 17 % Computer Science Department |
idamnjanovic@70 | 18 % Technion, Haifa 32000 Israel |
idamnjanovic@70 | 19 % ronrubin@cs |
idamnjanovic@70 | 20 % |
idamnjanovic@70 | 21 % April 2008 |
idamnjanovic@70 | 22 |
idamnjanovic@70 | 23 |
idamnjanovic@70 | 24 s = t; |
idamnjanovic@70 | 25 h = fix(s/3600); |
idamnjanovic@70 | 26 s = rem(s,3600); |
idamnjanovic@70 | 27 m = fix(s/60); |
idamnjanovic@70 | 28 s = rem(s,60); |