MATLAB: Set specific date ticks

datenumdatetickMATLABplotxticks

Hi trying to set specific date ticks. I don't understand why the following code does not work
figure()
hold on
box on
plot(date1,series1,'k')
plot(date1,series2,'r--')
xlabel('Date')
ylabel('Price')
DateString = {'06/30/2010';'11/30/2010'};
datenum(DateString);
set(gca, 'XTick', datenum(DateString))
dateFormat = 1;
datetick('x', dateFormat)

Best Answer

datetick('x', dateFormat, 'keepticks')