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!