clear

fileName = 'Aug12-2010-1434.17';
fidIn = fopen(strcat(fileName, '.xls'));
fidxBow = fopen(strcat(fileName, 'xBow.xls'), 'w');
fidTens = fopen(strcat(fileName, 'Tens.xls'), 'w');
fidiLink = fopen(strcat(fileName, 'iLink.xls'), 'w');

while ~feof(fidIn)
    strLine = char(fgets(fidIn));
    if( length(strLine) > 6)
        if( (strLine(1) == 'x') && (strLine(6) ~= 'G'));
            strLine = strcat(strLine, char(fgets(fidIn)));
            strLine = strcat(strLine, char(fgets(fidIn)));
            strLine = strcat(strLine, char(fgets(fidIn)));
            strLine = strcat(strLine, char(fgets(fidIn)));
            strLine = [strLine sprintf('\t%s',strtok(char(fgets(fidIn))))];
            fprintf(fidxBow, '%s\n', strLine);
        elseif (strLine(1) == 'T')
            fprintf(fidTens, '%s', strLine);
        elseif (strLine(1) == 'i')
            strLine = strcat(strLine, char(fgets(fidIn)));
            fprintf(fidiLink, '%s\n', strLine);
        end
    end
end
        
fclose('all');