Deleting columns in matrix based on specific looping
Show older comments
Hi,
I could really use some help/advice - I'm a novice when it comes to matlab.
Basically I start off by taking in an NxN matrix and have to cut out certain columns within it to only run a subsection of it through a secondary analysis script.
The matrix (NTot) is made up of average z-scores (from a fisher r to Z transformation, so it starts out as a correlation matrix) coming from two functional brain networks across a few dozen subjects. Let's say the two networks are N1 and N2. Each of these networks are made up of multiple nodes, and each element of the matrix is the z-score of the correlation between the two nodes' time series. Thus, NTot is an (NumNodesN1+NumNodesN2)x(NumNodesN1+NumNodesN2) matrix. What I need the code to do is the following:
1) Open up NTot
2) Remove the first NumNodesN1*(NumNodesN1+NumNodesN2) columns
3) Loop through the following:
a) Retain NumNodesN1 columns
b) Remove NumNodesN2 columns
c) Repeat (a) & (b) until you are left with NumNodesN1*NumNodesN2 columns
- This will represent a section of the NTot matrix (specifically the
bottom left) whereby one only has values representing the z-scores of
N1 to N2's nodes
For example: say I have two networks of interest (N1 & N2)
N1 has 8 nodes, or components, and N2 has 10 nodes/components. Therefore the matrix (NTot) is 18x18. Doing things by hand I would first open NetTot (Step 1, above) remove the first 144 columns (NumNodesN1*(NumNodesN1+NumNodesN2)) - Step 2, above). Then I would retain the next 8 columns (3a) and remove the following 10 columns (3b). I would repeat these steps (3c) until I'm left with an 8x10 matrix that only represents elements pairing N1 and N2's component nodes.
I think that, ideally, I would need a function that does the above and whose input would be NumNodesN1 and NumNodesN2 and whose output would be the manipulated matrix.
Thanks so much for your suggestions!
Accepted Answer
More Answers (0)
Categories
Find more on Loops and Conditional Statements 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!