load amo.txt
% loads 59x13 array
% each row is a year labelled in amo(:,1)
% each month of that year in amo(:,2:13)

year = amo(:,1);
amo_year = (year*ones(1,12))';
clear year;

amo=amo(:,2:13)';

[m,n]=size(amo);

amo = reshape(amo,m*n,1);

amo_year = reshape(amo_year, m*n,1);

amo_mos = (ones(n,1)*[1:12])';
amo_mos = reshape(amo_mos, m*n,1);

amo_day = ones(m*n,1)*15.;

amo_date = datenum(amo_year, amo_mos, amo_day);

amo = fillmiss(amo, -99, 10, NaN);

%shorten the series to get rid of trailing NaN's
I = find(isnan(amo));
amo(I) = [];
amo_date(I) = [];
amo_year(I) = [];
amo_mos(I) = [];
amo_day(I) = [];

save amo.mat

