-
Notifications
You must be signed in to change notification settings - Fork 0
/
p4_crcorr_network.m
49 lines (34 loc) · 1.12 KB
/
p4_crcorr_network.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
function [mean_crcorr, hub_mean_crcorr] = p4_crcorr_network(n,traces)
hub_mean_crcorr = [];
for i=1:10:n
cell_pairs = [];
for l=i+1:i+9
cell_pairs = [cell_pairs; [i, l]];
end
crcorr_cellpairs = zeros(length(cell_pairs),1);
for j=1:length(cell_pairs)
crcorr_cellpairs(j) = xcorr(traces(cell_pairs(j,1),:),traces(cell_pairs(j,2),:),0,'coeff');
end
crcorr_cellpairs_real = crcorr_cellpairs(~isnan(crcorr_cellpairs));
mean_crcorr = mean(crcorr_cellpairs_real);
hub_mean_crcorr = [hub_mean_crcorr; mean_crcorr];
end
hub_mean_crcorr = mean(hub_mean_crcorr);
for i = 1:n
temp1 = i*ones(n-1,1);
temp2 = (1:n)';
temp2 = temp2(temp2~=i);
temp = [temp1, temp2];
if i == 1
cell_pairs = temp;
else
cell_pairs = [cell_pairs; temp];
end
end
crcorr_cellpairs = zeros(length(cell_pairs),1);
for j=1:length(cell_pairs)
crcorr_cellpairs(j) = xcorr(traces(cell_pairs(j,1),:),traces(cell_pairs(j,2),:),0,'coeff');
end
crcorr_cellpairs_real = crcorr_cellpairs(~isnan(crcorr_cellpairs));
mean_crcorr = mean(crcorr_cellpairs_real);
end