close all;
clear all;
%dates=['1002';'1003';'1004';'1005';'1009';'1010';'1011';'1012';'1014';'1016';'1017';'1018';'1019';'1020';'1023';'1024';'1025';'1026';'1027';'1030';'1031';'1101';'1104';'1105';'1107';'1108';'1109';'1110'];
dates=['1002';'1003';'1004';'1005';'1010';'1011';'1012';'1014';'1016';'1017';'1018';'1019';'1020';'1024';'1026';'1027';'1101';'1105';'1107';'1109'];
legendString=[];
mycolor=jet(size(dates,1));

figure; hold on;
slopes=zeros(size(dates),2);
for i= 1: size(dates),
    load(strcat(dates(i,:),'.mat'));
   plot(PortConcTS,'Color',mycolor(i,:),'Marker','.','LineStyle','none'); hold on;
   legendString=[legendString;strcat(dates(i,1:2),'/',dates(i,3:4))];
    %Conc=PortConcTS(62:end-62);
    Conc=PortConcTS;
  X=[datenum(Conc.Time) ones(length(Conc.Time),1)];
  a=X\Conc.Data;
  slopes(i,1)=a(1);
  slopes(i,2)=a(2);
end
area=(pi*(15)^2)/1e4
% AveSlope=mean(slopes(:,1))
% rate=AveSlope/area
% std(slopes(:,1))
legend(legendString);
xlabel('Elapsed Experiment Time');
ylabel('O2 Conc (um)');
datetick('x','HH:MM');

print('-dill','PortConcSlope.ai')

%close all;
%clear all;
dates=['1002';'1003';'1004';'1005';'1009';'1010';'1011';'1012';'1014';'1016';'1017';'1018';'1019';'1020';'1023';'1024';'1025';'1026';'1027';'1031';'1101';'1104';'1105';'1107';'1108';'1109';'1110'];
legendString=[];
mycolor=jet(size(dates,1));

figure; hold on;
%slopes=zeros(size(dates),2);
last=size(slopes,1)


for i= 1: size(dates),
    load(strcat(dates(i,:),'.mat'));
   plot(StbdConcTS,'Color',mycolor(i,:),'Marker','.','LineStyle','none'); hold on;
   legendString=[legendString;strcat(dates(i,1:2),'/',dates(i,3:4))];
    Conc=StbdConcTS;
  X=[datenum(Conc.Time) ones(length(Conc.Time),1)];
  a=X\Conc.Data;
  slopes(i+last,1)=a(1);
  slopes(i+last,2)=a(2);
end
AveSlope=mean(slopes(:,1))
rate=AveSlope/area
stdev=std(slopes(:,1))/area
legend(legendString);
xlabel('Elapsed Experiment Time');
ylabel('O2 Conc (um)');
datetick('x','HH:MM');

print('-dill','StbdConcSlope.ai')