Info
이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.
How would I locate non-zeros given a condition?
조회 수: 1 (최근 30일)
이전 댓글 표시
Say that I have the matrix
1 0 1 1
0 0 0 1
0 0 0 0
and I want to find the row with a non-zero in the 4th column and at least 1 more non-zero in columns 1-3. Anyone know how I would approach this?
답변 (1개)
Alex Mcaulley
2020년 1월 28일
For example:
A = [1 0 1 1
0 0 0 1
0 0 0 0];
rows = find(A(:,4) & sum(A(:,1:3)~=0,2));
댓글 수: 1
이 질문은 마감되었습니다.
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!