% Filename:: concatenateBlock.m
% extract the time course of each task block, normalize them within blcoks, then concatenate acorss blocks,;% finally,calculated the FC derived from the concatenated time courses..%NEED: redefine cd and create result file
clear;
cd ('G:\fMRIanalysis\Task2_GRETNA\GretnaTimeCourse');
subList=dir('Sub?_*.txt');%extract task_specific time course;%task point:1:12;21:32;41:52;%baseline :13:20;33:40;53:60;for i=1:41;
subTS=load(subList(i).name);
id1=3:14;% raw:1:12,shift 2 time point,about 6 secends .
timec_Z1=subTS(id1,:);
id2=23:34;%raw:21:32
timec_Z2=subTS(id2,:);
id3=43:54;%raw:41:52;
timec_Z3=subTS(id3,:);%concatenate
timec_Z=[timec_Z1;timec_Z2;timec_Z3];%Pearson corr
FC_Z=corrcoef(timec_Z);
FC_Z = FC_Z -diag(diag(FC_Z));%Fisher r to z
zFC_Z =atanh(FC_Z);%txt
dlmwrite(['G:\fMRIanalysis\Task2_GRETNA\RawMatrix\MatrixR\r',subList(i).name],FC_Z,'delimiter','\t','precision','%-20.15e');dlmwrite(['G:\fMRIanalysis\Task2_GRETNA\RawMatrix\MatrixZ\z',subList(i).name],zFC_Z,'delimiter','\t','precision','%-20.15e');
end
disp done
MATLAB任务态脑网络 提取Block连接(不做Zscore)提取任务相关block的timeseries生成相关矩阵转换为z矩阵txt导出% extract the time course of each task block, normalize them within blcoks, then concatenate acorss blocks,;% finally,calculated the FC derived from the concatenated time cours