Path: news.mathworks.com!not-for-mail
From: "Dan Haeg" <haegd@msoe.edu>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Convert x-axis plot labels from epoch seconds to YYYY-MM-DD HH:mm:ss string?
Date: Wed, 7 Nov 2007 16:50:18 +0000 (UTC)
Organization: Milwaukee School of Engineering
Lines: 40
Message-ID: <fgsqca$dbc$1@fred.mathworks.com>
References: <fgr1g2$t5g$1@fred.mathworks.com>
Reply-To: "Dan Haeg" <haegd@msoe.edu>
NNTP-Posting-Host: webapp-02-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1194454218 13676 172.30.248.37 (7 Nov 2007 16:50:18 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Wed, 7 Nov 2007 16:50:18 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 475291
Xref: news.mathworks.com comp.soft-sys.matlab:436441



"Rob Newman" <rlnewman@ucsd.edu> wrote in message
<fgr1g2$t5g$1@fred.mathworks.com>...
> Hi there,
> 
> I am plotting some data where the x co-ordinate is in
epoch seconds (or unix 
> time, seconds since 1970-01-01 00:00:00). I would like to
convert *just* the 
> x-axis labels to an equivalent time string. For example,
if I have the x-axis 
> labels (automatically created by Matlab):
> 
> 1089865982
> 1089867030
> 1089868078
> 1089869126
> 1089870174
> 1089871222
> 1089872270
> 
> 
> I would like these to display as:
> 
> 2004-07-15 04:33:02
> 2004-07-15 04:50:30
> 2004-07-15 05:07:58
> 2004-07-15 05:25:26
> 2004-07-15 05:42:54
> 2004-07-15 06:00:22
> 2004-07-15 06:17:50
> 
> I have read about the graphics object properties like
XTickLabel and XTick, 
> but I cannot see documented anywhere how to format the
tick labels.
> 
> Thanks in advance. 

See the help for datetick. it may be what you are looking for.
Dan