MATLAB: Mtheyy date to matlab date

dates

Hi there.
I have a column vector with dates on the following format: yyyymm
E.g. [199001, 199002, 199003 …]'
They are all the last trading day of the month.
How can I transform them into matlab serial date numbers?
Thanks

Best Answer

x = [199001, 199012, 199003]';
% Calculate year and month
mm = rem(x,100);
yyyy = (x-mm)./100;
% get last business day (Financial Toolbox Req'd)
last_bus_day = lbusdate(yyyy,mm)