% NB: this is a script, not a function

[maunaLoaData] = textread('maunaloa.co2','',46,'delimiter',' ','headerlines',16);

% grab the columns for the monthly data and straighten them out into a vector
monthlyData = maunaLoaData(:,2:13);
monthlyData = monthlyData';
monthlyData = monthlyData(:);
% the data are for the middle of each month from 1958 through 2003
monthlyDates = (1958+1/24):(1/12):(2003+23/24);
% eliminate the missing data (the -99.99s)
monthlyDates = monthlyDates(monthlyData>0);
monthlyData = monthlyData(monthlyData>0);
% rescaled dates
scaledMonthlyDates = (monthlyDates-1981)/20;
% uncomment if you want a plot
%plot(monthlyDates,monthlyData)

% grab the last column that has the yearly averaged data
yearlyData = maunaLoaData(:,15);
% the years are in the first column
yearlyDates = maunaLoaData(:,1);
% eliminate the missing data (the -99.99s)
yearlyDates = yearlyDates(yearlyData>0);
yearlyData = yearlyData(yearlyData>0);
% rescaled dates
scaledYearlyDates = (yearlyDates-1981)/20;
% uncomment if you want a plot
%plot(yearlyDates,yearlyData)
