Use calendar function:
for year = 1993:2013
for month = 1:12
lastday = max(max(calendar(year,month)));
fprintf('%02d/%02d/%04d\n',lastday,month,year)
end
end
You can of course store result in matrix (or cell array) by changing fprintf with sprintf:
dates = char(zeros(12*21,10));
idx = 0;
for year = 1993:2013
for month = 1:12
idx = idx + 1;
lastday = max(max(calendar(year,month)));
dates(idx,:) = sprintf('%02d/%02d/%04d',lastday,month,year);
end
end
---EDIT---
I've found thath there is aslo eomday function. So instead of line:
lastday = max(max(calendar(year,month)));
You can use:
lastday = eomday(year,month);
To see the algorithm of eomday function type in MATLAB:
open eomday