md = mean(datenum({'2013_12_28', '2014_01_06'}, 'YYYY_mm_dd'));
dv = datevec(md);
days_into_year = md - datenum([dv(1),1,1]);
But once you have days_into_year you have to convert that into a year fraction, which requires careful definition of how long a "year" is. Is a "year" 365 days, always? Is a "year" 365.2421875 days? Is a "year" 365 days for non-leap years but 366 days for leap-years? If so then should it be 365 days for dates in the year before the leap day but 366 for dates on or after the leap day?
Converting to a specific date is much easier, and getting the result in terms of days is easy, but fraction of a year needs clarification.
Best Answer