This submission is a very simple code routine that I have used for many years for finding a maximal subset of linearly independent columns of a matrix. It is based on an old conversation with Bruno Luong, which has recently resumed here,
and where he gives some mathematical explanation behind the method. I post this here for ease of reference, as it seems to be a frequently sought tool by Matlab Community members.
Extract a linearly independent set of columns of a given matrix X
X: The given input matrix
tol: A rank estimation tolerance. Default=1e-10
Xsub: The extracted columns of X
idx: The indices (into X) of the extracted columns
>> A=eye(3); A(:,3)=A(:,2)
1 0 0
0 1 1
0 0 0
Matt J (2021). Extract linearly independent subset of matrix columns (https://www.mathworks.com/matlabcentral/fileexchange/77437-extract-linearly-independent-subset-of-matrix-columns), MATLAB Central File Exchange. Retrieved .
MATLAB Release Compatibility
Platform CompatibilityWindows macOS Linux
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!