filtering values in a matrix

조회 수: 5 (최근 30일)
suresh G
suresh G 2013년 3월 11일
for example I have a matrix
A=1 2
3 0
0 0
4 5
0 6
I need to filter out only those rows having no zeros(in this case [4 5]). thank you for your help.........
  댓글 수: 2
Image Analyst
Image Analyst 2013년 3월 11일
Why does row 1, with [1,2] in it, get to remain?
suresh G
suresh G 2013년 3월 11일
oh sorry.......that was a mistake by me.... also i need to filter out those rows with atleast one zero, so that my result should be A=[1 2; 4 5]

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

채택된 답변

Walter Roberson
Walter Roberson 2013년 3월 11일
A( all(A,2), : ) = [];
If "filter out" means to remove.
  댓글 수: 3
Walter Roberson
Walter Roberson 2013년 3월 11일
A( ~all(A,2), : ) = [];
suresh G
suresh G 2013년 3월 11일
thnx a lot.....

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

추가 답변 (0개)

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by