MATLAB: How to convert date into day of the year

convertday of the yearexcel

Hello!
Excel file format as follows:
  • A column: Year
  • B column: Month
  • C column: Day
  • D column: Hour
How can I calculate day of the year according to these column of xls file?
Sincerely…

Best Answer

You don't really need the hour of day.
data=xlsread('Lat30.xlsx');
date=datetime(data(:,1:3));
d=day(date,'dayofyear');