MATLAB: Date is element of some period in MATLAB

datedate element od periodMATLABperiod

Hi
I have a question that bother me. If I have a date, lets say 10.2012, how can i check he is element of period beetwen 14.10.12 and 1.1.2013.
Thank you in advance
Nejc

Best Answer

pstart = datenum('14.10.2012', 'dd.mm.yyyy');
pend = datenum('1.1.2013', 'dd.mm.yyyy');
testdate = datenum('5.10.2012', 'dd.mm.yyyy');
if testdate >= pstart & testdate < pend
disp('in testing range')
end