% Copy DVARS into GLM folder for inclusion as SPM regressor

IDs = {'1117';'1118';'1120';'1124';'1125';'1126';'1131';'1132';'1135';'1136';...
    '1151';'1160';'1164';'1167';'1169';'1172';'1173';'1178';'1182';'1214';...
    '1215';'1216';'1219';'1223';'1227';'1228';'1233';'1234';'1237';'1239';'1240';'1243';...
    '1245';'1247';'1250';'1252';'1257';'1261';'1265';'1266';'1268';'1270';'1276';'1281';...
    '2104';'2107';'2108';'2112';'2118';'2120';'2121';'2123';'2125';'2129';'2130';...
    '2132';'2133';'2134';'2135';'2139';'2140';'2145';'2147';'2149';'2157';...
    '2160';'2201';'2202';'2203';'2205';'2206';'2209';'2210';'2211';'2213';'2214';...
    '2215';'2216';'2217';'2219';'2222';'2224';'2226';'2227';'2236';'2238';...
    '2241';'2244';'2246';'2248';'2250';'2251';'2252';'2258';'2261'};

pn.DVARSdata = '/Volumes/LNDG/Projects/StateSwitch/dynamic/data/mri/task/preproc/B_data/D_preproc/';
pn.GLMpath = '/Users/kosciessa/Desktop/beegfs/StateSwitch/WIP/G_GLM/B_data/M_MotionParameters/';

for indID = 1:numel(IDs)
    for indRun = 1:4
        try
            curpath = [pn.DVARSdata, IDs{indID}, '/preproc2/run-', num2str(indRun),'/motionout_post/',IDs{indID},'_run-', num2str(indRun), '_feat_detrended_highpassed_denoised_dvars.txt'];
            target = [pn.GLMpath,IDs{indID}, '/',IDs{indID},'_run-', num2str(indRun), '_feat_detrended_highpassed_denoised_dvars.txt'];
            copyfile(curpath, target);
        catch
            display('Error');
        end
    end
end