How to calculate post-pre connectivity matrices for multiple subjects
조회 수: 1 (최근 30일)
이전 댓글 표시
Hi all,
I am a newbie in MATLAB and desperately need help. I have connectivity matrices (51x51) for 33 subjects for pre_intervention and post_intervention scans.
I would like to group all the 33 pre_intervention matrices and 33 post_intervention matrices, then calculate:
Gnew= Gpost- Gpre
And run a paired t-test.
The filenames are saved in this format: ABC_MS001_post_taskA_connectivity.mat
ABC_MS001_pre_taskA_connectivity.mat
ABC_MS002_post_taskA_connectivity.mat
ABC)MS002_pre_taskA_connectivity.mat
How can I load the concatenated Gpre to be subtracted from the concatenated Gpost .mat files?
댓글 수: 0
답변 (1개)
KSSV
2019년 8월 2일
편집: KSSV
2019년 8월 2일
postfiles = dir('*post*.mat') ; m = length(postfiles) ;
prefiles = dir('*pre*.mat') ; n = length(prefiles) ;
post = zeros(51,51,m) ;
pre = zeros(51,51,n) ;
for i = 1:m % as you said both the files are same in number so one loop
load(postfiles(i).name) ;
post(:,:,i) = Gpost ; % name the matrix in the mat file
pre(:,:,i) = Gpre ; % name the matrix in the mat file
end
Gnew= Gpost- Gpre ;
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!