File Exchange

image thumbnail

Day of year

version 1.0 (1.02 KB) by

A function that computes the day number (or day of year) for any given date, Enhanced.

3 Ratings

1 Download


View License

To use the function, simply download it to your working directory, then call the function 'doy' supplying the date vector.


returns 153 as the day number for 2-Jun-2003.

Note that the date vector can be in any format as recognized by MATLAB's DATEVEC. You can also convert a group of dates at once.


Comments and Ratings (5)


Bruno (view profile)

Simple and useful.
A help text would be a plus.


Osama (view profile)


AR B (view profile)

Very useful function

Chad Greene

Chad Greene (view profile)

To make this function work for arrays, change the n= line to

n = datenum([d(:,1:3), zeros(size(d,1),3)]) - datenum([d(:,1), ones(size(d,1),1),zeros(size(d,1), 4)]);

Jan Simon

Jan Simon (view profile)

Please do not submit a new file for the same function, but update the existing one.
A help text is required inside the function to make is usable and useful.

MATLAB Release
MATLAB 7.10 (R2010a)

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video