elimination of rows and columns
3 views (last 30 days)
Show older comments
Can anyone tell how do I eliminate rows and columns corresponding to a diagonal element of a symmetric matrix at a time?
0 Comments
Accepted Answer
Walter Roberson
on 31 May 2013
Let the matrix be A. Then to remove the row and column K, corresponding to A(K,K), use
B = A([1:K-1, K+1:end], [1:K-1, K+1:end]); %select all but row and column
or
B = A;
B(K,:) = []; %remove row
B(:,K) = []; %remove column
0 Comments
More Answers (0)
See Also
Categories
Find more on Operating on Diagonal Matrices 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!