MATLAB: Plot with dates on matlab

datesgraphs

Hi All, I have some historical time series prices for some assets in a matrix of size 295×34. (Matrix called Absy)
Also I have the corresponding 295 dates in another matrix (295×1) called dates. The dates are in the format of 20060606 20060613 etc (weekly).
I want to plot Absy but with the x axis being the corresponding dates.
When I do plot (dates,Absy) I get a wrong graph. Could someone help me.

Best Answer

One way:
Convert to a MATLAB serial date first, using datenum()
d = datenum('20060606','yyyymmdd')
then plot, and use the datetick() function.