Created
November 13, 2015 16:04
-
-
Save clbarnes/8255eac7122db12e6131 to your computer and use it in GitHub Desktop.
A proposed function for the Brain Connectivity Toolbox to remove self-loops from an input matrix
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function W_ = remove_self_loops(W) | |
| % REMOVE_SELF_LOOPS Removal of self-self connections from an input | |
| % matrix | |
| % | |
| % W_ = remove_self_loops(W); | |
| % | |
| % Return a copy of the input matrix with all self-self connections | |
| % removed (i.e. the primary diagonal set to all 0s). | |
| % | |
| % Inputs: W binary or weighted connectivity matrix | |
| % | |
| % Output: W_ output connectivity matrix | |
| % | |
| % | |
| % Chris Barnes, HHMI Janelia Research Campus, 2015 | |
| % Modification History: | |
| % Nov 2015: Original | |
| W_ = W.*(1-eye(length(W))); | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment