%% Michael Harris % 07/16/2013 % Lab 09
clc
clear all
%% Part 1
% Inputs of the data to be able to run the code
Full_Season=xlsread('data09.xls');
Both_Team_Scores=Full_Season(2:37,6:25);
Both_Team_Scores(isnan(Both_Team_Scores))=0;
Auburn=Both_Team_Scores(:,11:20);
Opponents=Both_Team_Scores(:,1:10);
Attendance=Full_Season(2:37,2);
Games=(1:36)';
%% Scores of the Games for auburn and the opponents
Aub_Tot_Scores=sum(Auburn,2);
Opp_Tot_Scores=sum(Opponents,2);
Margin_Wins=find(Aub_Tot_Scores>Opp_Tot_Scores);
Wins=numel(Margin_Wins);
Margin_Losses=find(Opp_Tot_Scores>Aub_Tot_Scores);
Losses=numel(Margin_Losses);
Winning_Amount=(Aub_Tot_Scores-Opp_Tot_Scores);
Winning_Spread=max(Winning_Amount);
Loosing_Amount=(Opp_Tot_Scores-Aub_Tot_Scores);
Loosing_Spread=max(Loosing_Amount);
%% Recording the Data so the user will be able to see
fprintf('Season Stats as of %d/%d/%d\n',[4,8,2012])
fprintf('Auburns season record: %d-%d\n',[Wins, Losses]);
fprintf('Largest Spread for Wins:%d\n',Winning_Spread);
fprintf('Largest Spread for Loss:%d\n',Loosing_Spread);
%% Plot for the Auburn Game Runs Vs. Game attendance for all the games
[h,x1,x2]=plotyy(Games,Aub_Tot_Scores,Games,Attendance);title('Auburn Games
Runs Vs Game Attendance');
set(x1,'linestyle','--');
xlabel('Number of Games');
ylabel('Auburn Runs');
ylabel(h(2),'Attendance');
legend('Auburn','Attendance');
pause(2)