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 Center および File ExchangeLogical についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by