Basic operations with matrices
Show older comments
I have 429 .mat numerical matrices which I need to import into the workspace.
Each of them has an identical structure (107 rows by 36 columns) and is sequentially named as 'subj_00000.mat' ... 'subj_00428.mat'.
After importing, I need to average all of them, to generate another matrix, which will also have a dimension of 107x36.
Finally, I need to linearly correlate each column of the average matrix with each column of each of the original 429 matrices, to generate a new matrix of 429 rows and 36 columns.
Any help on how to do this is highly appreciated.
Accepted Answer
More Answers (1)
Cris LaPierre
on 7 Dec 2018
1 vote
Your username caught my attention so thought I'd help you out a little.
My recommendation would be to build a 107 x 36 x 429 array. Each "slice" would be a different subject. For example, the matrix for subj_00000 would be at (:,:,1) and for subj_00428 would be at (:,:,429).
Taking the average is now trivial. Use the M = mean(A,dim) syntax of mean to average in the 3rd dimension, resulting in a 107x36 matrix.
You may find MATLAB Onramp helpful if you are just getting started with MATLAB. For what you ask here, chapter 5 may be helpful.
1 Comment
Connectome
on 8 Dec 2018
Edited: Connectome
on 8 Dec 2018
Categories
Find more on Logical in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!