function [] = LaTex(Action, Selector, AngleAssignment, SelectedAngles, time)

%
% If Everything is empty, start a new file
%
if strcmp(Action, 'OpenFile')
   LogMesg('    -> Creating New Table.tex file')
   TexFile = fopen('../images/Table.tex','wt+');
   fprintf(TexFile, '\\documentclass{article} \n \n');
   fprintf(TexFile, '\\begin{document} \n');
   fprintf(TexFile, '\\begin{tabular}{|cccc|} \n');
   fprintf(TexFile, 'Selector Type & Angle Assignment & Selected Angles & Time \\\\ \\hline \n');
   fclose(TexFile);
elseif strcmp(Action, 'AddRow')
   TexFile = fopen('../images/Table.tex', 'at+');
   fprintf(TexFile, '%s & %s & ', Selector, AngleAssignment);
   for a = 1 : length(SelectedAngles) - 1
      fprintf(TexFile, '%d, ', 5*SelectedAngles(a));
   end
   fprintf(TexFile, '%d ', 5*SelectedAngles(a+1));
   fprintf(TexFile, '& %6.2f ', time);
   fprintf(TexFile, '\\\\ \\hline \n');
   fclose(TexFile);
elseif strcmp(Action, 'CloseFile')
   LogMesg('    -> Closing Table.tex')
   TexFile = fopen('../images/Table.tex', 'at+');
   fprintf(TexFile, '\\end{tabular}');
   fprintf(TexFile, '\n \n');
   fprintf(TexFile, '\\end{document}');
   fclose(TexFile);
   LogMesg('    -> Compiling Table.tex')
   !pdflatex -halt-on-error -output-directory ../images Table.tex 
else
   LogMesg('RAD -> Frustrated in LaTex')
end
