elimination of rows and columns

3 views (last 30 days)
Can anyone tell how do I eliminate rows and columns corresponding to a diagonal element of a symmetric matrix at a time?

Accepted Answer

Walter Roberson
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

More Answers (0)

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!