-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathCCidx2_JP.m
39 lines (34 loc) · 1.04 KB
/
CCidx2_JP.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
% Cluster Connectivity index 2
% Get cluster connectivity index of neuronal groups of peaks.
% Mean of the groups' connectivity index
% (This is an idea of Jesús E. Pérez-Ortega, José Bargas, et al.)
%
% [CCI] = CCidx2_JP(g,Xp,idx)
%
% Inputs
% g = number of groups
% Xp = binary data as matrix PxC (P = #peaks, C = #cells)
% idx = indexes of group to which each data point belongs
%
% Outputs
% CCI = Connectivity index
%
% ..:: by Jesús E. Pérez-Ortega ::.. Mar-2012
function [CCI] = CCidx2_JP(g,Xp,idx)
P=size(Xp,1);
C_intra=zeros(g,1); % connectivity inter-group
single=0; % single neuronal vector
for i=1:g
clust = find(idx==i);
PM=Xp(clust,:);
idxPM=find(sum(PM,1));
PM=PM(:,idxPM);
if size(PM,1)==1 % if single not be taken into account
C_intra(i,1)=0; % unlike with the first version: 1 instead of 0
single=single+1;
else
C_intra(i,1)=CI_JP(PM);
end
end
% disp(C_intra)
CCI=sum(C_intra)/g; % unlike with the first version: g instead of (g-single)