
%% combine all units
USDR_combineall = [];
for i = 1:length(USDR)
    USDR_combineall = [USDR_combineall; USDR{i}'];
end

%% change in FR histogram (3hr)
nodrug_UFR = USDR_combineall(:,2); %the 3hr column
CNQX24hr_UFR = mean(USDR_combineall(:,3:10),2); %average of the 0-24hr bins
dUFR = CNQX24hr_UFR./nodrug_UFR;

bins = 0:0.05:15;
dat = histc(dUFR,bins)
bar(bins,dat);
xlim([0 2])

%% change in FR histogram over time
figure;

nodrug_UFR = USDR_combineall(:,2); %the 3hr column
CNQX3hr_UFR = USDR_combineall(:,3); %average of the 0-24hr bins
dUFR = CNQX3hr_UFR./nodrug_UFR;
subplot(8,1,1);
bins = 0:0.05:15;
dat = histc(dUFR,bins);
bar(bins,dat);
xlim([0 2])
median(dUFR)
iqr(dUFR)

CNQX6hr_UFR = USDR_combineall(:,4); %average of the 0-24hr bins
dUFR = CNQX6hr_UFR./nodrug_UFR;
subplot(8,1,2);
bins = 0:0.05:15;
dat = histc(dUFR,bins);
bar(bins,dat);
xlim([0 2])
median(dUFR)
iqr(dUFR)

CNQX9hr_UFR = USDR_combineall(:,5); %average of the 0-24hr bins
dUFR = CNQX9hr_UFR./nodrug_UFR;
subplot(8,1,3);
bins = 0:0.05:15;
dat = histc(dUFR,bins);
bar(bins,dat);
xlim([0 2])
median(dUFR)
iqr(dUFR)

CNQX12hr_UFR = USDR_combineall(:,6); %average of the 0-24hr bins
dUFR = CNQX12hr_UFR./nodrug_UFR;
subplot(8,1,4);
bins = 0:0.05:15;
dat = histc(dUFR,bins);
bar(bins,dat);
xlim([0 2])
median(dUFR)
iqr(dUFR)

CNQX15hr_UFR = USDR_combineall(:,7); %average of the 0-24hr bins
dUFR = CNQX15hr_UFR./nodrug_UFR;
subplot(8,1,5);
bins = 0:0.05:15;
dat = histc(dUFR,bins);
bar(bins,dat);
xlim([0 2])
median(dUFR)
iqr(dUFR)

CNQX18hr_UFR = USDR_combineall(:,8); %average of the 0-24hr bins
dUFR = CNQX18hr_UFR./nodrug_UFR;
subplot(8,1,6);
bins = 0:0.05:15;
dat = histc(dUFR,bins);
bar(bins,dat);
xlim([0 2])
median(dUFR)
iqr(dUFR)

CNQX21hr_UFR = USDR_combineall(:,9); %average of the 0-24hr bins
dUFR = CNQX21hr_UFR./nodrug_UFR;
subplot(8,1,7);
bins = 0:0.05:15;
dat = histc(dUFR,bins);
bar(bins,dat);
xlim([0 2])
median(dUFR)
iqr(dUFR)

CNQX24hr_UFR = USDR_combineall(:,10); %average of the 0-24hr bins
dUFR = CNQX24hr_UFR./nodrug_UFR;
subplot(8,1,8);
bins = 0:0.05:15;
dat = histc(dUFR,bins);
bar(bins,dat);
xlim([0 2])
median(dUFR)
iqr(dUFR)

%% compare medians














