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일

0 개 추천

blnOut = find(all(ismember(A,[0,-1]),2));

댓글 수: 3

Andrei Bobrov
Andrei Bobrov 2013년 6월 7일
corrected
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.

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

추가 답변 (0개)

카테고리

도움말 센터 및 File Exchange에서 MATLAB에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by