delete rows with a special number

조회 수: 1 (최근 30일)
dav
dav 2013년 3월 22일
Hi ,
can someone please help me to delete the entire rows with 99?
A=
[ 0.0125 0.9025
99.0000 99.0000
99.0000 99.0000
99.0000 99.0000
99.0000 99.0000
0.1162 0.0176
99.0000 99.0000
99.0000 99.0000
99.0000 99.0000
99.0000 99.0000]
thanks.

채택된 답변

Azzi Abdelmalek
Azzi Abdelmalek 2013년 3월 22일
편집: Azzi Abdelmalek 2013년 3월 22일
A(any(A==99,2),:)=[]
  댓글 수: 4
Matt Tearle
Matt Tearle 2013년 3월 22일
To clarify: the 2 is a dimension argument for the any function. A==99 produces a matrix of logical values (T/F). By default any(A==99) applies an OR operation down each column, independently. So any(A==99,2) changes that to an OR operation across each row. The result is a column vector that is true wherever there's a 99 in the corresponding row of A.
dav
dav 2013년 3월 22일
thank you very much!

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

추가 답변 (1개)

vipul utsav
vipul utsav 2013년 3월 22일
ind=find(A==99.0000);
A(ind)=0;
A=A;
  댓글 수: 1
dav
dav 2013년 3월 22일
thanks a lot Azzi and vipul.

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

카테고리

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