How can i skip the zeros in a matrix?

조회 수: 1 (최근 30일)
Maayan
Maayan 2013년 9월 11일
Hi, I have a matrix with columns filled with zeros and i want to copy the matrix into a new matrix but to skip the columns with the zeros. Is there any command that can help me? I tried to do it with the sparse command but i didn't really understand what happens there. It skips the zeros but when you want to know how many columns you have in the new matrix it still shows the initial size. thanks in advance!

채택된 답변

Walter Roberson
Walter Roberson 2013년 9월 11일
NewMatrix = OldMatrix(any(OldMatrix,1),:);

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Logical에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by