% Analyze Water Flow 4545.  
close all
Load_rtplt(4); %Full Magnet Flow Test Measurement at 115 delta pressure (only 4545).


figure('units','normalized','outerposition',[0 0 0.9 0.9]);
plot(RT4.Flow, mm(1));
xlabel('Measurement #');
ylabel('Flow Rate (gpm)')
title('Full Magnet Flow Rate of LCLS-II Dipole 4545 - BCXDLU2');
hline(mean(RT4.Flow), 'b--',['Beginning Flow = ', num2str(mean(RT4.Flow)), ' gpm']);
hline(mean(RT4.Flow) + std(RT4.Flow),'b', 'mean + std');
hline(mean(RT4.Flow) - std(RT4.Flow),'b','mean - std');


% Write summary file with the fuull manget and individual flows. 
   
  data_file = 'Magnet Flow Rate of LCLS-II Dipole 4545 - BCXDLU2.txt';   
    f_title = '                      Magnet Flow Rate of LCLS-II Dipole 4545 - BCXDLU2 \n\n' ;
    
fidC = fopen(data_file,'w');
fprintf(fidC,f_title);

fprintf(fidC,'    Full Magnet   \n');
fprintf(fidC,'       (gpm)          \n');
fprintf(fidC,'Mean   %5.3f      \n', mean(RT4.Flow));                
fprintf(fidC,'Stdev  %5.3f    ', std(RT4.Flow));                
fclose(fidC);