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


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


% Write summary file with the fuull manget and individual flows. 
   
  data_file = 'Magnet Flow Rate of LCLS-II Dipole 4527 - BCXDLU4.txt';   
    f_title = '                      Magnet Flow Rate of LCLS-II Dipole 4527 - BCXDLU4 \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(RT8.Flow));                
fprintf(fidC,'Stdev  %5.3f    ', std(RT8.Flow));                
fclose(fidC);