function CFibreTotal = CompileFibre(code)
% loads the fiber data of files containing 'code' and displays graph

t = dir;
CFibreTotal = 0;
for i = 3:size(t,1)
   if findstr(code,t(i,1).name)
      freadid = fopen(t(i,1).name,'r');
      if (freadid == -1) 
         disp('Error trying to open file for binary reading');
      else
         CFibre = fread(freadid,'double');
         status = fclose(freadid);
         disp([t(i,1).name, '  ', num2str(CFibre(1)),' Photons']);
         CFibreTotal = CFibreTotal + CFibre; 
      end
   end
end

figure;
semilogy([1:size(CFibreTotal,1)-1]-1,CFibreTotal(2:size(CFibreTotal,1)));
