In matlab I have used accumarray() to create a new vector with 3 columns of integers. Column 1: date (just the day); Column 2: hour; Column 3: Sample Value.
19.0000 9.0000 25.6937
19.0000 10.0000 30.2616
19.0000 11.0000 32.2840
19.0000 12.0000 28.4867
19.0000 14.0000 35.4055
19.0000 16.0000 48.3377
Right now my code for plotting the graph involves the following;
xdate = datenum(year,month,day,hourVector,minutes,seconds);
plot(xdate,sampleValue,'-x','MarkerSize',10)
datetick('x','ddd HHPM')
I'm having trouble finding a method where the x-axis is labeled once every hour (or 2 hours). Thanks
I guess you just want the x ticks to be spaced by 1 hour, independently of the data spacing? From your example, I don't see that you necessarily have a data point once an hour.
If my understanding is correct, try replacing
datetick('x','ddd HHPM')
with the following:
hr_step = 0.0417; % increasing datenum by this amount will advance date by 1 hour
tick_xdate = min(xdate):hr_step:max(xdate);
set(gca,'XTick',tick_xdate)
datetick('x','ddd HHPM','keepticks') % 'keepticks' option forces the use of tick_xdate