I have an issue.
I have a matrix of pairwise neuronal correlations. Which means if I have 137 neurons, my matrix is 137x137. So element (13,46) is the correlation between the 13th and the 46th neurons. I want to find all such pairs that have a correlation value of for e.g. > 0.5 (I want to test various thresholds). Then I just want to find the neurons that form these pairs. So if for e.g. the pairs are (13,46), (13,56), (46,56), the output needs to be - 13,46,56.
I first get the lower-half of my symmetric correlation matrix, and replace the upper half in this triangular matrix with NaNs. I also replace the diagonal 1s with NaNs.
And then I use [x,y]=find() to get the subscripts of the elements that exceed my threshold. I then use unique() on the x to get the unique neurons that form these pairs.
The correlation matrix has negative corrs and positive corrs. I only ask for let's say very high correlations. So I end up with around 900 pairs. When I ask for the unique neurons that form these pairs, I get 122 out of 137 for corrs > 0.5, but I get 127 for corrs > 0! This is weird right?
Here is my code -
sigCorrMat = tril(SU(iDataset).signalCorrelation);
sigCorrMat(sigCorrMat==1) = NaN;
sigCorrMat(sigCorrMat==0) = NaN;
[x,y]=find(sigCorrMat > thr(1) & sigCorrMat < thr(2));
allUnits = unique(x);
I would be very grateful if someone could help me out. Thanks!