clear;clc;

cd /home/subhadip/Autism_AnatNet/austistic_study

subjdir=dir('aH*');

maindir='/home/subhadip/Autism_AnatNet/austistic_study/';

setenv('FSLOUTPUTTYPE','NIFTI');

for l=1:10%length(subjdir)
    
datafiles=strcat(maindir,subjdir(l).name,'/data*.nii.gz');

tempfiles=dir(datafiles);

for m=1:length(tempfiles)
    
inputfile= strcat(maindir,subjdir(l).name,'/',tempfiles(m).name);
outputfile= strcat(maindir,subjdir(l).name,'/','eddycorrected_',tempfiles(m).name);

[status currdir] = system([' eddy_correct ' inputfile  ' chk' 0 ])

% newfile=load_untouch_nii('chk.nii');
% strrep('chk.nii','chk',)

end

end
