フィルターのクリア

find a row with -1

1 回表示 (過去 30 日間)
Light
Light 2013 年 6 月 7 日
A=[-1,1,1;0,-1,0;0,0,-1;1,0,0];
blnA = logical( A == -1 );
blnOut = find( sum( blnA' ) == 1 );
With that command
blnOut =
1 2 3
I have to find row which include only one -1 or other element in row must be 0 not 1. In that matrix, row including 1 is found too.
So 2nd row must be chosen.
Thank you

採用された回答

Andrei Bobrov
Andrei Bobrov 2013 年 6 月 7 日
編集済み: Andrei Bobrov 2013 年 6 月 7 日
blnOut = find(all(ismember(A,[0,-1]),2));
  3 件のコメント
Light
Light 2013 年 6 月 7 日
編集済み: Light 2013 年 6 月 7 日
Same result. blnOut =
1
2
3
Must be the
blnOut=
2
3
i have to find row which including only -1. row 1 is including 1.
Walter Roberson
Walter Roberson 2013 年 6 月 7 日

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeSpreadsheets についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by