Hi there I have a large matrix A. I want to delete every row which contains at least 1 zero in the row.

 채택된 답변

Andrei Bobrov
Andrei Bobrov 2012년 6월 7일

14 개 추천

out = A(all(A,2),:);
or
out=A;
out(any(A==0,2),:) = [];

댓글 수: 2

Anthony Mukanya
Anthony Mukanya 2015년 8월 17일
이동: Voss 2024년 3월 24일
Thanks Andrei,
I tried what you suggested and it worked.
Now I would like to know what I should do keep the last row even if it contains a zero. The reason for this is because the entry on the nth row and jth must be zero.
Thanks
Alyaa Ghazi
Alyaa Ghazi 2024년 3월 24일
great,it's very useful

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Multidimensional Arrays에 대해 자세히 알아보기

질문:

2012년 6월 7일

이동:

2024년 3월 24일

Community Treasure Hunt

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

Start Hunting!

Translated by