I would like to remove some columns and rows from a large matrix. These are columns and rows that have all zeros. Is there any function in MATLAB that can do this for you pretty quickly? My matrices are sparse. I do like this:
% To remove all zero columns from A ind = find(sum(A,1)==0) ; A(:,ind) = [] ; % To remove all zeros rows from A ind = find(sum(A,2)==0) ; A(ind,:) = [] ;
It would be nice to have a line of code for this, as I can repeat this task. Thanks
source share