Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
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, 4 Nov 2009 15:18:02 +0000 (UTC)
Organization: Chopper Trading, LLC
Lines: 21
Message-ID: <hcs5va$s40$1@fred.mathworks.com>
References: <fgr1g2$t5g$1@fred.mathworks.com> <fgsqca$dbc$1@fred.mathworks.com> <fgt3j9$k07$1@canopus.cc.umanitoba.ca> <fr5sbq$rcn$1@fred.mathworks.com>
Reply-To: <HIDDEN>
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 1257347882 28800 172.30.248.37 (4 Nov 2009 15:18:02 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Wed, 4 Nov 2009 15:18:02 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1882340
Xref: news.mathworks.com comp.soft-sys.matlab:582403


Any ideas on how to make that gui? Would it require making controls to do the zooming or can you do it using the standard charting toolbar?

THanks.

"Dirco du Toit" <fake@dummy.com> wrote in message <fr5sbq$rcn$1@fred.mathworks.com>...
> > datetick requires that the data for the axis must
> > be in serial date format, which "seconds since
> > 1970-01-01 00:00:00" is not.
>  
> The way I did it was to add the datenum for 1970-01-01 to 
> my time value, then convert that to a datestr (otherwise it 
> still looks like a number and not a date).
> 
> MyDateNum = (datenum([1970 1 1 0 0 0])*86400 + 
> MyTimeValue) / 86400;
> MyDateStr = datestr(MyDateNum, 'yyyy/mm/dd HH:MM:SS');
> 
> Just remember that your custom X-tick labels are now text 
> values, so it won't scale along with your plot if you 
> resize it. (I had to make my own GUI to make it recalculate 
> the dates after every window resize.)