Datetime x-ticks for 6-month intervals
It looks like you want to set xtick, not minor ticks.
If your data are in datetime format and you want half-year ticks on January 1st and July1st for every year,
startDate = dateshift(min(dt), 'start', 'year');
endDate = dateshift(max(dt), 'start', 'year') + calyears(1);
dtTicks = startDate : calmonths(6) : endDate;
set(gca, 'XTick', dtTicks, 'xlim', dtTicks([1,end]))
You can edit for datetime tick format using
datetick('x','mmm-yy','keeplimits','keepticks')
datetick('x','QQ-yyyy','keeplimits','keepticks')
Demo
dt = datetime(2005,03,16) + caldays(0:20:1000);
data = (0:20:1000).^2;
plot(dt, data, 'o')
To place labels between ticks
Since Matlab does not support minor-tick labels, and since we cannot specify the position of a tick label independently from the tick positions, you'll have to use a workaround.
One workaround is to use text objects as xtick labels but that gets sloppy when the figure is resized or the axis limits are changed.
Another workaround is to add a 2nd underlying axis that controls the xtick labels while the main axis controls the xticks. That's demonstrated below. See inline comments for details.
dt = datetime(2005,03,16) + caldays(0:20:3000);
data = (0:20:3000).^2;
axUnder = cla();
ax = copyobj(axUnder, ancestor(axUnder,'figure'));
plot(ax, dt, data, 'o')
startDate = dateshift(min(dt), 'start', 'year');
endDate = dateshift(max(dt), 'start', 'year') + calyears(1);
dtTicks = startDate : calmonths(6) : endDate;
xticks = dtTicks(1:2:end);
xtickLabs = repmat({' '},size(xticks));
set(ax, 'XTick', xticks, 'XLim', [min(dtTicks),max(dtTicks)],'XTickLabel', xtickLabs)
plot(axUnder, dt(1), nan, 'x')
dtTicksLabs = cellstr(datestr(dtTicks(1:2:end),'yyyy'));
set(axUnder, 'XTick', dtTicks(2:2:end),'XTickLabel', dtTicksLabs, 'xlim', ax.XLim)
axUnder.YTick = [];
title(ax, '9-year trends')
xlabel(ax, 'Years')
ylabel(ax, 'stuff (units)')
linkprop([ax,axUnder],{'Position','InnerPosition','XLim'});
axUnder.HandleVisibility = 'off';