axis datetick set XTick rounding error
Afficher commentaires plus anciens
Hey,
I just produced a couple of graphs with date as label on the x axis. Using the datetick('x','dd mm'); gets the dateformat I want with the dates placed at the right place. When i'm now using the
set(gca,'XTick',alldates) with alldates = [ 734684, 734690, 734693, 734696, 734711, 734715]
to display my important dates the following dates show up: 26.06, 03.07, 10.07, 17.07 24.07, 31.07
Obviously ,beside of the last date, these dates are wrong. datestr(alldates, 'dd mm') = [ 30 06, 06 07, 09 07, 12 07, 27 07, 31 07]
Changing back the date formate to datenum gives 7.3468, 73469, 734697, 7.347, 7.3471 and 7.3472 x 10°5 show up on the axis.
Using datestr on the last numbers gives back the wrong dates.
Looking at the write and the wrong datenum's the wrong ones seem like a rounded version of the right ones. So how can I tell matlab not to round my XTicks before converting them into the right format? Thanks a lot and cheers Helge
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Dates and Time dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!