MATLAB: How to plot average monthly data from excel using matlab R2013a

excel

Hello, I am trying to open data in excel file and then plot average monthly data. my code shown like this:
*filename ='Palembang.xlsx';
[num, txt, alldata]= xlsread(filename);
data = num(:,4);
jan = mean(data(7:361,:)); % raw data 7 until 361
feb = mean(data(362:844,:));
mar = mean(data(845:1201,:));
apr = mean(data(1202:1542,:));
may = mean(data(1543:1869,:));
jun = mean(data(1870:2261,:));
jul = mean(data(2262:2536,:));
aug = mean(data(2537:3051,:));
sep = mean(data(3052:3616,:));
oct = mean(data(3617:4297,:));
nov = mean(data(4298:4833,:));
dec = mean(data(4834:5273,:));
%get all the months of 2014
startdate = datenum('01-01-2014','dd-mm-yyyy');
enddate = datenum('31-12-2014','dd-mm-yyyy');
xdata = linspace(startdate,enddate,12);
ydata =
plot(xdata,ydata)
hold on
datetick('x','mmm','keepticks');
hold off*
in ydata it's still blank, because I dont know yet what command should I write there to plot the average data for each month? I hope somebody knows a better way to do it. thank you for everyone

Best Answer

ydata = [jan feb mar apr may jun ...
jul aug sep oct nov dec]; %it should work.
%other options, make a matrix of 12 columns representing each month
%fill empty date with NaN. use the function ydata = mean(matrix, 2)