clear; clc; 

cd /home/subhadip/Autism_AnatNet/austistic_study/Diffusion_Analysis/90_regions/aHU0003.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);
matrix(l,l)=0;
end

asym_connection_matrix=(matrix);
% asym_connection_probability_matrix=asym_connection_matrix/5000;
sym_connection_matrix=(matrix+transpose(matrix));
% sym_connection_probability_matrix=sym_connection_matrix/10000;

save('/home/subhadip/Autism_AnatNet/austistic_study/Diffusion_Analysis/90_regions/connection_matrix_asym_aHU0003.txt','asym_connection_matrix','-ascii');
% save('/home/subhadip/Autism_AnatNet/austistic_study/Diffusion_Analysis/90_regions/connection_probability_matrix_asym_aHU0879.txt','asym_connection_probability_matrix','-ascii');

save('/home/subhadip/Autism_AnatNet/austistic_study/Diffusion_Analysis/90_regions/connection_matrix_sym_aHU0003.txt','sym_connection_matrix','-ascii');
% save('/home/subhadip/Autism_AnatNet/austistic_study/Diffusion_Analysis/90_regions/connection_probability_matrix_sym_aHU0879.txt','sym_connection_probability_matrix','-ascii');
