
clear;clc;

roi_vox_numbers=load('/home/subhadip/Autism_AnatNet/austistic_study/Diffusion_Analysis/90_regions/aalROI_voxnumbers_Normalsubj.txt');

subject=30; number_fiberes=5000;

cd /home/subhadip/Autism_AnatNet/austistic_study/Diffusion_Analysis/90_regions/aHU0879.bedpostX

files=dir('region*.txt');


matrix(1:length(files):1:length(files))=zeros;

for l=1:length(files)
    
chk=load(files(l).name);
matrix(l,:)=sum(chk)/(roi_vox_numbers(subject,l)*number_fiberes);

matrix(l,l)=0;
end

asym_connection_matrix=matrix;
sym_connection_matrix=(matrix+transpose(matrix))/2;

save('/home/subhadip/Autism_AnatNet/austistic_study/Diffusion_Analysis/90_regions/adj_matrixes/Connectivity_Probability_weighted/asymmetric/Connection_Matrix_asym_aHU0879.txt','asym_connection_matrix','-ascii');

save('/home/subhadip/Autism_AnatNet/austistic_study/Diffusion_Analysis/90_regions/adj_matrixes/Connectivity_Probability_weighted/symmetric/Connection_Matrix_sym_aHU0879.txt','sym_connection_matrix','-ascii');