MATLAB: Problem with datenum (R2012a)

datenum problem

Hello,
I'm a French student, and I need your help about datenum.
I want to use it with Year Month Day and Hour The problem is that it don't work fine, I only can do Year Month Day or Year Month Day Hour Minute Seconds.
I tried to create myself a time vector to go over this problem but it don't work.
I've to read data of [Rn] and [CH4] hour per hour over 1 month of data, each measure should have a number that datenum should do…
Matlab version is R2012a
Thanks in advance for the help

Best Answer

Based on your data...
% Data snippet
data = [...
2011 06 01 00 1898.800 0.423
2011 06 01 01 1905.340 0.765
2011 06 01 02 1901.140 0.685
2011 06 01 03 1900.540 0.740
2011 06 01 04 1905.690 0.739
2011 06 01 05 1922.490 0.995];
% Datenumbers
dn = datenum([data(:,1:4) zeros(size(data,1),2)])
% Hours elapsed relative to first point
hr = (dn - dn(1))*24