Use the 'Format' name-value pair:
T = ['21:01'
'21:02'
'21:03'
'21:04'];
Time2plot = datetime(T, 'inputformat','HH:mm', 'Format','HH:mm')
produces:
Time2plot =
4×1 datetime array
21:01
21:02
21:03
21:04
figure
plot(Time2plot, rand(4,1))
grid
xtickformat('HH:mm')
However, it still has the date associated with it below the x-axis.
The only way I can think of to get around that is:
dn = datenum(Time2plot);
figure
plot(dn, rand(4,1))
grid
datetick('x', 'hh:mm', 'keepticks')
Experiment to get the result you want.
