From: Steven_Lord on 9 Aug 2010 09:30 "Ashish Uthama" <first.last(a)mathworks.com> wrote in message news:i3oqpm$1vv$1(a)fred.mathworks.com... > Have a quick look through this might be very useful for your project: > > > http://www.mathworks.com/access/helpdesk/help/techdoc/matlab_prog/bspgcx2-1.html#bspgc4m-1 > Or please paste this in the MATLAB command window: > web([docroot,'/techdoc/matlab_prog/bspgcx2-1.html#bspgc4m-1']) > > > An example of what Steve suggested: (the above material would help > understand this) > > %c is the cell array of strings as returned by XLSREAD. > >> c{1}='2003-01-01T00:00'; > >> c{2}='2010-12-02T17:23'; > >> v = datevec(c,'yyyy-mm-ddTHH:MM') > > v = > > 2003 1 1 0 0 0 > 2010 12 2 17 23 0 > > > or > > >> v = datenum(c,'yyyy-mm-ddTHH:MM') > > v = > > 1.0e+05 * > > 7.3158 > 7.3447 > > You could use the single datenum value to plot against (i.e as the > x-axis). And once you've done that plotting, use DATETICK to format the labels on the axes as dates. % use the datenum version of v for this plot(v, [1; 2]); datetick('x') Adjust the format specifier in DATETICK to show the date in the format you want. -- Steve Lord slord(a)mathworks.com comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ To contact Technical Support use the Contact Us link on http://www.mathworks.com
From: Peter on 10 Aug 2010 04:31
Thanks to Ashish Uthama and to Steven_Lord - really appreciate your help datevec, datenum and datetick are the keys. Once again, thanks for helping me out, saved lots of time. |