Is there a built-in function that removes the Kth row and column of a square matrix in Matlab?
Hope this is clear from the diagram:
alt text http://img121.imageshack.us/img121/8145/cutmatrix.png
Here are two simple solutions:
x([1:k-1 k+1:end],[1:k-1 k+1:end])
or
x(k,:)=[];x(:,k)=[];
If you want to use this operation more often, creating a function is a good idea.
% filename: removeK.m function M1 = removeK (M, k) M1 = M([1:k-1 k+1:end],[1:k-1 k+1:end]); end
Not a built-in function, but the following line does the trick:
y = [x(1:(k-1),1:(k-1)) x(1:(k-1),(k+1):end) ; x((k+1):end,1:(k-1)) x((k+1):end,(k+1):end)];
Source: https://habr.com/ru/post/1303176/More articles:The issue of using Excel range (cell error checking) - c #What are processor registers and how are they used, in particular WRT multithreading? - assemblyNULL Characters in Firebird VARCHAR - nullJquery slider vertically not working - jqueryUIScrollView in UIScrollView - iphoneError loading application - ruby-on-railsInsert int into Enum in Delphi Prism - delphiRunning glass fish when loading in windows - windowsUITableViewCell imageView.contentMode not working in version 3.0 - iphoneif (variable == [any item in the collection]) in Java - javaAll Articles