www.gusucode.com > graphics 案例源码程序 matlab代码 > graphics/LabelxAxisTickswithHoursoftheDayExample.m
%% Label x-Axis Ticks with Hours of the Day % Plot traffic count data against date ticks for hours of the day showing % AM and PM. % Copyright 2015 The MathWorks, Inc. %% % Get traffic count data. load count.dat %% % Create arrays for an arbitrary date, for example, April 18, 1995. n = length(count); year = repmat(1995,1,n); month = repmat(4,1,n); day = repmat(18,1,n); %% % Create arrays for each of 24 hours. hour = 1:n; minutes = zeros(1,n); %% % Get the serial date numbers for the date arrays. sdate = datenum(year,month,day,hour,minutes,minutes); %% % Plot a 3-D bar graph of the traffic data against the serial date numbers. bar3(sdate,count) %% % Label the tick lines of the graph's _y_-axis with the hours of the day. datetick('y','HHPM')