% compile upshift
path = 'bralaprosteadystate';
cd(path);
eval(['load ',path]);
fprintf('For directory %s, %d cells with mean width %g\n',path,alldata.ncells,mean(alldata.midthickness*0.13));
up(1,1:alldata.ncells) = alldata.midthickness*0.13;
n(1) = alldata.ncells;
cd ..
    
path = 'brupshift1hour';
cd(path);
eval(['load ',path]);
fprintf('For directory %s, %d cells with mean width %g\n',path,alldata.ncells,mean(alldata.midthickness*0.13));
up(2,1:alldata.ncells) = alldata.midthickness*0.13;
n(2) = alldata.ncells;
cd ..
    
path = 'brupshift2hour';
cd(path);
eval(['load ',path]);
fprintf('For directory %s, %d cells with mean width %g\n',path,alldata.ncells,mean(alldata.midthickness*0.13));
up(3,1:alldata.ncells) = alldata.midthickness*0.13;
n(3) = alldata.ncells;
cd ..
    
path = 'brupshift3hour';
cd(path);
eval(['load ',path]);
fprintf('For directory %s, %d cells with mean width %g\n',path,alldata.ncells,mean(alldata.midthickness*0.13));
up(4,1:alldata.ncells) = alldata.midthickness*0.13;
n(4) = alldata.ncells;
cd ..
    
path = 'brupshift4hour';
cd(path);
eval(['load ',path]);
fprintf('For directory %s, %d cells with mean width %g\n',path,alldata.ncells,mean(alldata.midthickness*0.13));
up(5,1:alldata.ncells) = alldata.midthickness*0.13;
n(5) = alldata.ncells;
cd ..
    
for j=1:numel(n)
  up(j,n(j)+1:end) = NaN;    
end
   
hist([up(1,:)',up(2,:)',up(3,:)',up(4,:)',up(5,:)'],[0.5:0.01:1.2]);
legend('ss','1hr','2hr','3hr','4hr');
print('-dpdf','upshift-width.pdf');

% compile downshift
path = 'brglucaasteadystate';
cd(path);
eval(['load ',path]);
fprintf('For directory %s, %d cells with mean width %g\n',path,alldata.ncells,mean(alldata.midthickness*0.13));
down(1,1:alldata.ncells) = alldata.midthickness*0.13;
nd(1) = alldata.ncells;
cd ..
    
path = 'brdownshift2hour';
cd(path);
eval(['load ',path]);
fprintf('For directory %s, %d cells with mean width %g\n',path,alldata.ncells,mean(alldata.midthickness*0.13));
down(2,1:alldata.ncells) = alldata.midthickness*0.13;
nd(2) = alldata.ncells;
cd ..
    
path = 'brdownshift4hour';
cd(path);
eval(['load ',path]);
fprintf('For directory %s, %d cells with mean width %g\n',path,alldata.ncells,mean(alldata.midthickness*0.13));
down(3,1:alldata.ncells) = alldata.midthickness*0.13;
nd(3) = alldata.ncells;
cd ..
    
for j=1:numel(nd)
  down(j,nd(j)+1:end) = NaN;    
end
   
hist([down(1,:)',down(2,:)',down(3,:)'],[0.5:0.01:1.2]);
legend('ss','2hr','4hr');
print('-dpdf','downshift-width.pdf');

% compile upshift
path = 'mg1655alaprosteadystate';
cd(path);
eval(['load ',path]);
fprintf('For directory %s, %d cells with mean width %g\n',path,alldata.ncells,mean(alldata.midthickness*0.13));
upm(1,1:alldata.ncells) = alldata.midthickness*0.13;
nm(1) = alldata.ncells;
cd ..
    
path = 'mg1655upshift1hour';
cd(path);
eval(['load ',path]);
fprintf('For directory %s, %d cells with mean width %g\n',path,alldata.ncells,mean(alldata.midthickness*0.13));
upm(2,1:alldata.ncells) = alldata.midthickness*0.13;
nm(2) = alldata.ncells;
cd ..
    
path = 'mg1655upshift2hour';
cd(path);
eval(['load ',path]);
fprintf('For directory %s, %d cells with mean width %g\n',path,alldata.ncells,mean(alldata.midthickness*0.13));
upm(3,1:alldata.ncells) = alldata.midthickness*0.13;
nm(3) = alldata.ncells;
cd ..
    
for j=1:numel(nm)
  upm(j,nm(j)+1:end) = NaN;    
end
   
hist([upm(1,:)',upm(2,:)',upm(3,:)'],[0.5:0.01:0.9]);
legend('ss','1hr','2hr');
print('-dpdf','upshift-mg1655-width.pdf');

% compile downshift
path = 'mg1655glucaasteadystate';
cd(path);
eval(['load ',path]);
fprintf('For directory %s, %d cells with mean width %g\n',path,alldata.ncells,mean(alldata.midthickness*0.13));
downm(1,1:alldata.ncells) = alldata.midthickness*0.13;
ndm(1) = alldata.ncells;
cd ..
    
path = 'mg1655downshift2hour';
cd(path);
eval(['load ',path]);
fprintf('For directory %s, %d cells with mean width %g\n',path,alldata.ncells,mean(alldata.midthickness*0.13));
downm(2,1:alldata.ncells) = alldata.midthickness*0.13;
ndm(2) = alldata.ncells;
cd ..
    
path = 'mg1655downshift4hour';
cd(path);
eval(['load ',path]);
fprintf('For directory %s, %d cells with mean width %g\n',path,alldata.ncells,mean(alldata.midthickness*0.13));
downm(3,1:alldata.ncells) = alldata.midthickness*0.13;
ndm(3) = alldata.ncells;
cd ..
    
for j=1:numel(ndm)
  downm(j,ndm(j)+1:end) = NaN;    
end
   
hist([downm(1,:)',downm(2,:)',downm(3,:)'],[0.5:0.01:1.2]);
legend('ss','2hr','4hr');
print('-dpdf','downshift-mg1655-width.pdf');
