Show time in x axis with increments of 10minutes
16 views (last 30 days)
I was wondering whether it is possible to plot a graph with time on x axis that varies with 10 minute (or 15 minute or 20 minute) increment (i.e. as per our choice). For instance, I have two times:
t_start = 10-Jun-2015 03:30:00 (which is the start time)
t_end = 10-Jun-2015 05:00:00 (is the end time)
How can I have a plot with x axis containing ticks such as 03:30, 03:40, 03:50........04:40, 04:50, 05:00.
xtks = linspace(t_start, t_end, 20);
But this just produces an x axis with 20 equally divided ticks (not increments as shown above). I tried with 10, 15, etc instead of 20 for xtks but still it does'not come out as expected.
Any help is appreciated.
Walter Roberson on 4 Apr 2022
t_start = datetime('10-Jun-2015 03:30:00'); %(which is the start time)
t_end = datetime('10-Jun-2015 05:00:00'); %(is the end time)
t = t_start : minutes(1) : t_end;
ndata = length(t);
data = rand(1, ndata);