Code covered by the BSD License  

Highlights from
Day of Year to MATLAB date

5.0

5.0 | 4 ratings Rate this file 52 Downloads (last 30 days) File Size: 1.68 KB File ID: #24235

Day of Year to MATLAB date

by

 

22 May 2009 (Updated )

Converts a day of year number and a year to a date in MATLAB format

| Watch this File

File Information
Description

DOY2DATE.m will convert a vector of day of year numbers and years
and convert them to MATLAB date format.
 
Sample Call:
 doyV = [54;200.4315];
 yearV = [2009;2009];
 [dateV] = doy2date(doyV,yearV);

Inputs:
 doyV -> vector of day of year numbers (n x 1)
 yearV -> vector of years (n x 1)

Outputs:
 dateV -> vector of MATLAB dates (n x 1)

function [dateV] = doy2date(doyV,yearV)
z = zeros(length(yearV),5);
dv = horzcat(yearV,z);
dateV = doyV + datenum(dv);

Acknowledgements

Date To Decimal Day Of Year inspired this file.

This file inspired F10.7 Solar Flux & Ap Indices.

MATLAB release MATLAB 7.4 (R2007a)
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (4)
15 Sep 2014 D  
02 Feb 2012 Liisa  
24 Oct 2011 alexzhao zhao  
06 Oct 2011 Salman

Your script was helpful in finding out the "key" 3 lines of code that did the job for me:
z = zeros(length(yearV),5);
dv = horzcat(yearV,z);
dateV = doyV + datenum(dv);

Updates
22 May 2009

fixed typo in title

Contact us