
clear; clc;

cd /home/k1514724/subhadip/BBC/DTI_rsfMRI_ConnectivityMatrices/nuisances28_regdout_aal90_timeseries

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

for l=1:length(files)
    temp=load(files(l).name); % temp stores the time-series data in Time x Space format
    z=0; % this ensures that r values are not z-transformed. for z-transformed r values, z value should be 1
    netmat=nets_netmats(temp,z,'ridgep'); % We are estimating partial correlation using L2-norm Ridge Regression (aka Tikhonov) with default rho=0.1
    save(strrep(files(l).name, 'NuisancesRegdOut', 'Netmat_rsfMRI'),'netmat','-ascii')
end