% readNflTeams.m        P. Conrad for CISC106, 07F
% set up a cell array containing data from nflTeams.txt
% column 1: team name
% column 2: stadium capacity
% column 3: ticket price
% columm 4: wins so far this season (as of 10/10/2007)

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% read input into lines array     %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

[lines, howMany] = readFileToCellArray('nflTeams.txt');

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% pre-allocate cell array   %
% this improves efficiency  %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

nfl = cell(howMany, 4); % howMany rows, 4 columns

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% loop through the lines, parsing out %
% input and filling cells             %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

for i=[1:howMany]

  % make a cell array of this row 
  thisRow = regexp(lines{i},' ','split');

  % loop through this row, copying into the big array

  for j=[1:4]
     nfl{i,j} = thisRow{j};
  end

end

% end of readNflTeams.m



