help > Input matrices
Showing 1-2 of 2 posts
Display:
Results per page:
May 7, 2017  03:05 PM | Hua Yu
Input matrices
Dear all,

Recently, I was using graph theory glm tools to do some analysis.  I already have my correlation matrices;  for each subject, I have a mat file containing a 160x160 matrice, all the subjects' files are in order like 001.mat, 002.mat, ... N.mat. Actually, I have difficulty in creating an input matrice for all the N subjects, can you kindly help me how to create a 160 x 160 x n matrice?

Best regards.

Hua
May 8, 2017  09:05 AM | Devon Shook
RE: Input matrices
Hello Hua,

To get your matrices into a single file put all the N.mat files into a single folder and run the following code:

clear;
sbjs=dir('*.mat');
for n = 1:length(sbjs)
load(sbjs(n).name);
CorMats(:,:,n)=corr_z;
end
save('CorMats','CorMats');


Just change "corr_z" to whatever the variable is inside the 001.mat, etc. file. Then you'll have a single file called "CorMats" that contains a 160x160xN variable of your matrices.

gl,
Devon