% sushi19308

sushi19308_cell01 = [sortrows(sushi19308_E0x2D195_VC0x2D1,2); ...
    sortrows(sushi19308_E0x2D195_VC0x2D2,2); ...
    sortrows(sushi19308_E0x2D195_VC0x2D3,2)];
sushi19308_cell02 = [sortrows(sushi19308_E0x2D196_VC0x2D1,2); ...
    sortrows(sushi19308_E0x2D196_VC0x2D2,2)];
sushi19308_cell04 = [sortrows(sushi19308_E0x2D198_VC0x2D1,2); ...
    sortrows(sushi19308_E0x2D198_VC0x2D2,2)];
sushi19308_cell05 = [sortrows(sushi19308_E0x2D199_VC0x2D2,2); ...
    sortrows(sushi19308_E0x2D199_VC0x2D3,2); ...
    sortrows(sushi19308_E0x2D199_VC0x2D4,2)];
sushi19308_cell06 = [sortrows(sushi19308_E0x2D200_VC0x2D1,2); ...
    sortrows(sushi19308_E0x2D200_VC0x2D3,2)];
sushi19308_cell07 = [sortrows(sushi19308_E0x2D201_VC0x2D1,2); ...
    sortrows(sushi19308_E0x2D201_VC0x2D2,2)];
sushi19308_cell08 = sortrows(sushi19308_E0x2D202_VC0x2D1,2);
sushi19308_cell09 = sortrows(sushi19308_E0x2D203_VC0x2D1,2);
sushi19308_cell10 = sortrows(sushi19308_E0x2D204_VC0x2D1,2);
sushi19308_cell11 = sortrows(sushi19308_E0x2D205_VC0x2D1,2);

sushi19309_cell01 = [sortrows(sushi19309_E0x2D205_VC0x2D1,2); ...
    sortrows(sushi19309_E0x2D205_VC0x2D2,2)];
sushi19309_cell03 = sortrows(sushi19309_E0x2D207_VC0x2D1,2);
sushi19309_cell04 = sortrows(sushi19309_E0x2D208_VC0x2D2,2);
sushi19309_cell05 = sortrows(sushi19309_E0x2D209_VC0x2D1,2);
sushi19309_cell06 = sortrows(sushi19309_E0x2D210_VC0x2D1,2);
sushi19309_cell07 = [sortrows(sushi19309_E0x2D211_VC0x2D1,2); ...
    sortrows(sushi19309_E0x2D211_VC0x2D2,2)];
sushi19309_cell08 = sortrows(sushi19309_E0x2D212_VC0x2D1,2);
sushi19309_cell09 = sortrows(sushi19309_E0x2D213_VC0x2D1,2);
sushi19309_cell10 = [sortrows(sushi19309_E0x2D214_VC0x2D1,2); ...
    sortrows(sushi19309_E0x2D214_VC0x2D1,2)];
sushi19309_cell11 = [sortrows(sushi19309_E0x2D215_VC0x2D1,2); ...
    sortrows(sushi19309_E0x2D215_VC0x2D1,2)];
sushi19309_cell12 = [sortrows(sushi19309_E0x2D216_VC0x2D2,2); ...
    sortrows(sushi19309_E0x2D216_VC0x2D3,2)];


%% calculate frequency

freq_19308{1} = 1000./diff(sushi19308_cell01(:,2)); freq_19308{1} = freq_19308{1}(freq_19308{1}>0.1 & freq_19308{1}<100);
freq_19308{2} = 1000./diff(sushi19308_cell02(:,2)); freq_19308{2} = freq_19308{2}(freq_19308{2}>0.1 & freq_19308{2}<100);
freq_19308{3} = [];
freq_19308{4} = 1000./diff(sushi19308_cell04(:,2)); freq_19308{4} = freq_19308{4}(freq_19308{4}>0.1 & freq_19308{4}<100);
freq_19308{5} = 1000./diff(sushi19308_cell05(:,2)); freq_19308{5} = freq_19308{5}(freq_19308{5}>0.1 & freq_19308{5}<100);
freq_19308{6} = 1000./diff(sushi19308_cell06(:,2)); freq_19308{6} = freq_19308{6}(freq_19308{6}>0.1 & freq_19308{6}<100);
freq_19308{7} = 1000./diff(sushi19308_cell07(:,2)); freq_19308{7} = freq_19308{7}(freq_19308{7}>0.1 & freq_19308{7}<100);
freq_19308{8} = 1000./diff(sushi19308_cell08(:,2)); freq_19308{8} = freq_19308{8}(freq_19308{8}>0.1 & freq_19308{8}<100);
freq_19308{9} = 1000./diff(sushi19308_cell09(:,2)); freq_19308{9} = freq_19308{9}(freq_19308{9}>0.1 & freq_19308{9}<100);
freq_19308{10} = 1000./diff(sushi19308_cell10(:,2)); freq_19308{10} = freq_19308{10}(freq_19308{10}>0.1 & freq_19308{10}<100);
freq_19308{11} = 1000./diff(sushi19308_cell11(:,2)); freq_19308{11} = freq_19308{11}(freq_19308{11}>0.1 & freq_19308{11}<100);

disp([10,'frequency (Hz) for CNQX + ChR2 Stimulation']);
for i = 1:length(freq_19308)
        disp([num2str(mean(freq_19308{i})),' +/- ',num2str(std(freq_19308{i})/length(freq_19308{i})),'   (n=',num2str(length(freq_19308{i})),')']);
end

freq_19309{1} = 1000./diff(sushi19309_cell01(:,2)); freq_19309{1} = freq_19309{1}(freq_19309{1}>0.1 & freq_19309{1}<100);
freq_19309{2} = [];
freq_19309{3} = 1000./diff(sushi19309_cell03(:,2)); freq_19309{3} = freq_19309{3}(freq_19309{3}>0.1 & freq_19309{3}<100);
freq_19309{4} = 1000./diff(sushi19309_cell04(:,2)); freq_19309{4} = freq_19309{4}(freq_19309{4}>0.1 & freq_19309{4}<100);
freq_19309{5} = 1000./diff(sushi19309_cell05(:,2)); freq_19309{5} = freq_19309{5}(freq_19309{5}>0.1 & freq_19309{5}<100);
freq_19309{6} = 1000./diff(sushi19309_cell06(:,2)); freq_19309{6} = freq_19309{6}(freq_19309{6}>0.1 & freq_19309{6}<100);
freq_19309{7} = 1000./diff(sushi19309_cell07(:,2)); freq_19309{7} = freq_19309{7}(freq_19309{7}>0.1 & freq_19309{7}<100);
freq_19309{8} = 1000./diff(sushi19309_cell08(:,2)); freq_19309{8} = freq_19309{8}(freq_19309{8}>0.1 & freq_19309{8}<100);
freq_19309{9} = 1000./diff(sushi19309_cell09(:,2)); freq_19309{9} = freq_19309{9}(freq_19309{9}>0.1 & freq_19309{9}<100);
freq_19309{10} = 1000./diff(sushi19309_cell10(:,2)); freq_19309{10} = freq_19309{10}(freq_19309{10}>0.1 & freq_19309{10}<100);
freq_19309{11} = 1000./diff(sushi19309_cell11(:,2)); freq_19309{11} = freq_19309{11}(freq_19309{11}>0.1 & freq_19309{11}<100);
freq_19309{12} = 1000./diff(sushi19309_cell12(:,2)); freq_19309{12} = freq_19309{12}(freq_19309{12}>0.1 & freq_19309{12}<100);

disp([10,'frequency (Hz) for CNQX-treated culture']);

for i = 1:length(freq_19309)
    disp([num2str(mean(freq_19309{i})),' +/- ',num2str(std(freq_19309{i})/length(freq_19309{i})),'   (n=',num2str(length(freq_19309{i})),')']);
end


%% calculate amplitude

amp_19308{1} = sushi19308_cell01(:,3);
amp_19308{2} = sushi19308_cell02(:,3);
amp_19308{3} = [];
amp_19308{4} = sushi19308_cell04(:,3);
amp_19308{5} = sushi19308_cell05(:,3);
amp_19308{6} = sushi19308_cell06(:,3);
amp_19308{7} = sushi19308_cell07(:,3);
amp_19308{8} = sushi19308_cell08(:,3);
amp_19308{9} = sushi19308_cell09(:,3);
amp_19308{10} = sushi19308_cell10(:,3);
amp_19308{11} = sushi19308_cell11(:,3);

disp([10,'amplitude (pA) for CNQX + ChR2 Stimulation']);
for i = 1:length(amp_19308)
    disp([num2str(mean(amp_19308{i})),' +/- ',num2str(std(amp_19308{i})/length(amp_19308{i})),'   (n=',num2str(length(amp_19308{i})),')']);
    overall_mean.sushi19308(i,:) = [length(amp_19308{i}) mean(amp_19308{i})];
end

amp_19309{1} = sushi19309_cell01(:,3);
amp_19309{2} = [];
amp_19309{3} = sushi19309_cell03(:,3);
amp_19309{4} = sushi19309_cell04(:,3);
amp_19309{5} = sushi19309_cell05(:,3);
amp_19309{6} = sushi19309_cell06(:,3);
amp_19309{7} = sushi19309_cell07(:,3);
amp_19309{8} = sushi19309_cell08(:,3);
amp_19309{9} = sushi19309_cell09(:,3);
amp_19309{10} = sushi19309_cell10(:,3);
amp_19309{11} = sushi19309_cell11(:,3);
amp_19309{12} = sushi19309_cell12(:,3);

disp([10,'amplitude (pA) for CNQX-treated culture']);

for i = 1:length(amp_19309)
    disp([num2str(mean(amp_19309{i})),' +/- ',num2str(std(amp_19309{i})/length(amp_19309{i})),'   (n=',num2str(length(amp_19309{i})),')']);
    overall_mean.sushi19309(i,:) = [length(amp_19309{i}) mean(amp_19309{i})];
end

disp([10,'average across cells (for cells with at least 30 events) in pA:']);
disp(['CNQX+stim: ', ...
    num2str(mean(overall_mean.sushi19308(find(overall_mean.sushi19308(:,1)>=30),2)))]);
disp(['CNQX only: ', ...
    num2str(mean(overall_mean.sushi19309(find(overall_mean.sushi19309(:,1)>=30),2)))]);

disp([10,'average across cells (for cells with at least 28 events) in pA:']);
disp(['CNQX+stim: ', ...
    num2str(mean(overall_mean.sushi19308(find(overall_mean.sushi19308(:,1)>=28),2)))]);
disp(['CNQX only: ', ...
    num2str(mean(overall_mean.sushi19309(find(overall_mean.sushi19309(:,1)>=28),2)))]);

disp([10,'average across cells (for cells with at least 24 events) in pA:']);
disp(['CNQX+stim: ', ...
    num2str(mean(overall_mean.sushi19308(find(overall_mean.sushi19308(:,1)>=24),2)))]);
disp(['CNQX only: ', ...
    num2str(mean(overall_mean.sushi19309(find(overall_mean.sushi19309(:,1)>=24),2)))]);

disp([10,'average across cells (for cells with at least 20 events) in pA:']);
disp(['CNQX+stim: ', ...
    num2str(mean(overall_mean.sushi19308(find(overall_mean.sushi19308(:,1)>=20),2)))]);
disp(['CNQX only: ', ...
    num2str(mean(overall_mean.sushi19309(find(overall_mean.sushi19309(:,1)>=20),2)))]);


%% calculate decay

decay_19308{1} = sushi19308_cell01(:,5);
decay_19308{2} = sushi19308_cell02(:,5);
decay_19308{3} = [];
decay_19308{4} = sushi19308_cell04(:,5);
decay_19308{5} = sushi19308_cell05(:,5);
decay_19308{6} = sushi19308_cell06(:,5);
decay_19308{7} = sushi19308_cell07(:,5);
decay_19308{8} = sushi19308_cell08(:,5);
decay_19308{9} = sushi19308_cell09(:,5);
decay_19308{10} = sushi19308_cell10(:,5);
decay_19308{11} = sushi19308_cell11(:,5);

disp([10,'decay (ms) for CNQX + ChR2 Stimulation']);
for i = 1:length(decay_19308)
        disp([num2str(mean(decay_19308{i})),' +/- ',num2str(std(decay_19308{i})/length(decay_19308{i})),'   (n=',num2str(length(decay_19308{i})),')']);
end

decay_19309{1} = sushi19309_cell01(:,5);
decay_19309{2} = [];
decay_19309{3} = sushi19309_cell03(:,5);
decay_19309{4} = sushi19309_cell04(:,5);
decay_19309{5} = sushi19309_cell05(:,5);
decay_19309{6} = sushi19309_cell06(:,5);
decay_19309{7} = sushi19309_cell07(:,5);
decay_19309{8} = sushi19309_cell08(:,5);
decay_19309{9} = sushi19309_cell09(:,5);
decay_19309{10} = sushi19309_cell10(:,5);
decay_19309{11} = sushi19309_cell11(:,5);
decay_19309{12} = sushi19309_cell12(:,5);

disp([10,'decay (ms) for CNQX-treated culture']);

for i = 1:length(decay_19309)
    disp([num2str(mean(decay_19309{i})),' +/- ',num2str(std(decay_19309{i})/length(decay_19309{i})),'   (n=',num2str(length(decay_19309{i})),')']);
end
