delete zeros rows and columns
조회 수: 1 (최근 30일)
이전 댓글 표시
i try do delete rows and columns that are zeros but it cut also part of shape .I use this code
u=I;
old=[];
new=all(~u);
while ~isequal(old,new)
u(new,:)=0;
old=new;
new=all(~u);
end
u(new,:)=[];
u(:,new)=[];
av=u;
av(~any(u,2),:)=[];
%radious of puple
figure, imshow(av,[]);
so any other way to do that
댓글 수: 0
채택된 답변
추가 답변 (2개)
Andrea
2012년 5월 30일
data( all( ~any( data), 2 ), : ) = []; % removes all rows with all zero
data( :, all( ~any( data ), 1 ) ) = []; % and columns
댓글 수: 0
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!