% tempPlot2.m   P.Conrad for CISC106
% a more successful attempt to plot mean temperature for 
% 9/1/2006 through 10/25/2006 

% load the data file.   This version of the load command
% uses a string argument to the load function and stores
% the result in a matrix called "data" instead of "sepOctTemps"

data = load('sepOctTemps.dat');

% pull out the columns we want to plot into separate vectors
% we want to put day on the x axis, and mean temp on the y axis
% see the data file itself for a comment that describes the columns

year = data(:,1);
month = data(:,2);
day = data(:,3);
meanTemp = data(:,5);


for k= 1:length(day)
  ordDay(k) = ordinalDay(month(k), day(k), year(k));
  elapsedDays(k) = ordDay(k) - ordDay(1);
end; % for


% plot day on x axis, meanTemp on y, and label the axes

plot(elapsedDays,meanTemp);
xlabel('day');
ylabel('mean temperature (degrees F)');
title('Mean Temperature in Wilmington DE (take 2)');

% set the x axis of the plot to 0 through last elapsedDay
% and set the y axis to 0 through 100

axis([0 elapsedDays(end) 0 100])

theURL = cisc106plot('lab08', 'tempPlot2.jpg');

fprintf ('Plot written to %s\n',theURL);

