MATLAB: Write a date loop in matlab

loop date means time series

Hello all,
I am very new to Matlab so I hope you guys can help me out.
The thing is,
I have to create a loop which calculate portfolio means on an annual basis. The assets in the portfolio are mkt, hml and mom. The starting date is 19261103(yyyymmdd), ending date is 20121231 (yyyymmdd). So from 19271103 onwards, I need to retrieve the means per asset.
My problem is that I am just not able to create a loop that proceeds onwards, because not every year November 3rd, is a trading day (it can be a Saturday or a Sunday). How can I avoid this problem and retrieve annual 1×3 matrices from 1927 till 2012?
Hope I formulated this problem well.
Thank you very much in advance.
Kevin

Best Answer

d1=datenum('1926-11-03','yyyy-mm-dd'),
d2=datenum('2012-12-31','yyyy-mm-dd'),
d=d1:d2
for k=1:numel(d)
%do
end