Cutting rows and columns from a matrix
이전 댓글 표시
If A = [0,0,0,0;0,0,0,0;0,0,1,1;0,0,1,1], how can i cut out the null comumns and rows to acheive B = [1,1;1,1]
채택된 답변
추가 답변 (1개)
Andrei Bobrov
2011년 5월 20일
B = zeros(sum(any(A,2)),sum(any(A)));
B(:)=A(A~=0);
카테고리
도움말 센터 및 File Exchange에서 Linear Algebra에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!