MATLAB: Set x axis into hour

axishourtable

Hi,
I have a table with 2 columns: 1st column is Hour, and the other is other values. So, I want to make a plot with some values on the y axis, and the x axis will be time (hours). I want to start it from 11:00 PM (4/4/2015) until 9:00 PM (5/4/2015).
Can anyone help me?
Thanks 🙂

Best Answer

This is one possibility:
x = 1:24; % Create Data

y = randi([2 4], 1, length(x)); % Create Data
figure(1)
plot(x, y)
set(gca, 'XTick', [1:2:24], 'XTickLabel', rem([1:2:24]+10,24))
axis([1 23 0 5])
xlabel('Time (Hr)')
Related Question