find a row with -1
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
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
0 Commenti
Risposta accettata
Andrei Bobrov
il 7 Giu 2013
Modificato: Andrei Bobrov
il 7 Giu 2013
blnOut = find(all(ismember(A,[0,-1]),2));
3 Commenti
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Spreadsheets in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!