Plotting use datenum
1 view (last 30 days)
Show older comments
Hello, I want to make a Matlab plot with the months of the year on the x-axis. I am trying to plot a total of 17520 readings (48 per day) on the y-axis and then show the months on the x-axis. The problem with the code I am using now is that the vectors are different lengths (b is 12 and a is 17520).
Here is my code:
function [y] = doc_concentration
a = xlsread ('DOC_Conc_2007-2011.xlsx',1,'A3:A17522');
startDate = datenum('01-01-2007');
endDate = datenum('12-31-2007');
b = linspace(startDate,endDate,12);
length(a)
length (b)
plot (b,a)
set(gca,'XTick',g)
datetick('x','mmm','keepticks')
end
Can anyone help? Thanks in advance.
Maeve
1 Comment
Jan
on 26 Jan 2012
Please format your code properly using the "{} code" button. I've done this for you this time.
See Also
Categories
Find more on Dates and Time in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!