No BSD License  

Highlights from
Time display

2.0

2.0 | 1 rating Rate this file 11 Downloads (last 30 days) File Size: 2.02 KB File ID: #8318

Time display

by Po Hu

 

19 Aug 2005 (Updated 19 Aug 2005)

Display time in format hh:mm:ss instead of soconds like in toc.

| Watch this File

File Information
Description

Normally MATLAB itself supplies a set of buildin function tic and toc to read stopwatch timer. But toc returns time in seconds, and accumulate every time when user type 'toc' before another 'tic' is entered. sometimes it is hard to read a during time in seconds. So this function helps to convert seconds to normal digital watch format hh:mm:ss.

MATLAB release MATLAB 7.0.1 (R14SP1)
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (1)
19 Aug 2005 urs (us) schwarz

1) some of the code is unneccessarily duplicated
2) what if the user runs for days or even years?
3) it would be nice to be able to provide a user defined message
4) this emulates the main engine of this snippet

tic;pause(1.25);t=toc;
fmt='%.2d-%.2d-%.2d %.2d:%.2d:%7.4f';
t=datevec(t/86400);
s=strrep(sprintf(fmt,t),': ',':0')

just some thoughts, us

Please login to add a comment or rating.
Tag Activity for this File
Tag Applied By Date/Time
clock Po Hu 22 Oct 2008 07:56:15
fun Po Hu 22 Oct 2008 07:56:15
time Po Hu 22 Oct 2008 07:56:15
display Po Hu 22 Oct 2008 07:56:15
toc Po Hu 22 Oct 2008 07:56:15
tic Po Hu 22 Oct 2008 07:56:15
digital Po Hu 22 Oct 2008 07:56:15
clock Alexandra 17 May 2011 10:28:15
clock Peter 10 Jun 2011 09:56:20

Contact us at files@mathworks.com