3.5

3.5 | 6 ratings Rate this file 115 downloads (last 30 days) File Size: 2.02 KB File ID: #4300

timetick

by Scott Hirsch

 

19 Dec 2003 (Updated 20 Feb 2009)

Code covered by BSD License  

Time formatted tick labels.

Download Now | Watch this File

File Information
Description

TIMETICK sets current axes to time formatted tick labels. X Axis must be time, in datenum format.
 
TIMETICK(AX) sets axes with handle AX to time formatted tick labels.
 
TIMETICK(AX,precision) sets axes with handle AX to time formatted tick labels with precision values to the right of the decimal for seconds specifier.

Use TIMETICK instead of DATETICK when you want fractional second precision. Unlike DATETICK, TIMETICK works well with ZOOM.

See also TIMESTR.

MATLAB release MATLAB 6.5 (R13)
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (9)
25 Nov 2005 JARRAD YUNG-TAO CHOU

NOT USED YET

21 Mar 2006 rick zhang

It did not work for me in 7.0.1.24704 (R14) Service Pack 1 although timestr worked. I received the message below. Hope the author will fix it soon.

>> timetick('x', 'HH:MM:SS.SSSS')
??? Error using ==> get
Invalid handle.

Error in ==> timetick at 26
xt = get(ax,'XTick');

20 Apr 2006 Mike Russell

Implementation can be improved. I improved its capability to include all axis's. The timestr function seems a little involved since it is performing datestr for however many ticks you have chosen.

If anyone has come to a solution on how to update the tick labels after zoom let me know.

Thanks

30 Jan 2009 Alex Fay

And now in English.
fmt = ['%02d:%02d:%0' totalwidth '.' precision 'f'];

The leading zero also works on fixed-point. For example, if the seconds format is '%07.4f', a seconds value of 0.440 seconds comes out as '00.4400'.

31 Jan 2009 Alex Fay  
31 Jan 2009 Alex Fay

I aded some more edits, I can't seem to upload them, though.

08 May 2009 Hithesh

To resolve the error mentioned in 2nd reply, just use timetick
without any input. Default is x axis.
(credit: Scott Hirsch)

24 Jul 2009 Rob Newman

What about if you have a long time series (years) and want output in YYYY-MM-DD? This function only seems to be relevant for second/microsecond time periods????? Any ideas? Thanks.

24 Jul 2009 Rob Newman

My bad - just found the datetick() function. Please ignore previous post...

Please login to add a comment or rating.
Updates
20 Feb 2009

Bug fix: No longer displays a trailing period when displaying time of second resolution (as opposed to fractional second).

Before: "12:24:31." Now: "12:24:31" with no trailing period. Thanks to Alex Fay for identifying and fixing the bug.

Tag Activity for this File
Tag Applied By Date/Time
strings Scott Hirsch 22 Oct 2008 07:11:32
time Scott Hirsch 22 Oct 2008 07:11:32
second Scott Hirsch 22 Oct 2008 07:11:32
seconds Scott Hirsch 22 Oct 2008 07:11:32
microseco Scott Hirsch 22 Oct 2008 07:11:32
microsecond Scott Hirsch 22 Oct 2008 07:11:32
miliseconds Scott Hirsch 22 Oct 2008 07:11:32
milisecond Scott Hirsch 22 Oct 2008 07:11:32
microseconds Scott Hirsch 20 Feb 2009 13:51:15
 

MATLAB Central Terms of Use

NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Terms prior to use.

Contact us at files@mathworks.com