% readsenselabaccess.m
% loads four cell matricies access_ip, access_time, access_page, access_query 
% with strings

% read in the data file

% fid = fopen('c:\docume~1\Administrator\desktop\senselabstats1', 'rt');
%fid = fopen('c:\docume~1\Administrator\desktop\senselabstats2', 'rt');
fid = fopen('c:\docume~1\morse\desktop\matlabsenselab\access.log', 'rt');
% y = 0;
cell_size=1e5;
% c=cell(1,cell_size);
access_ip=cell(1,cell_size);
access_time=cell(1,cell_size);
access_page=cell(1,cell_size);
access_query=cell(1,cell_size);
i=1;
numofcells=0;
% top_links=cell(1,50); 
% top_links_flag=0; % turn true while doing top links
% l_i=1;  %   top_links index

while feof(fid) == 0
    tline = fgetl(fid);
    %  disp(tline);
    literal=',';
    matches = findstr(tline, literal);
    num = length(matches);
    if num ~= 3
%         y = y + num;
        disp(['Error: There are ' int2str(num) ' matches of '','' in ' tline]);
    end
    access_ip(i)=cellstr(tline(1:matches(1)-1));
    access_time(i)=cellstr(tline(matches(1)+1:matches(2)-1));
    access_page(i)=cellstr(tline(matches(2)+1:matches(3)-1));
    access_query(i)=cellstr(tline(matches(3)+1:end));

    i=i+1;
end
numofcells=i-1;
