Indexing Logical Array Intersections

조회 수: 11 (최근 30일)
Arda
Arda 2021년 5월 30일
편집: Stephen23 2021년 5월 30일
row_max =
3×3 logical array
0 0 1
0 0 1
0 0 1
col_min =
3×3 logical array
1 1 1
0 0 0
0 0 0
I have these logical arrays. I want to find the intersection index of them where there must be the same element in the same index. In this example I would need (1,3), since it would be the same element and at the same index at col_min(1,3) and row_max(1,3). Thanks.

채택된 답변

Dyuman Joshi
Dyuman Joshi 2021년 5월 30일
[r, c] = find((row_max&col_min)==1);
  댓글 수: 4
Dyuman Joshi
Dyuman Joshi 2021년 5월 30일
I agree that it is not required, however it might be a useful point to note for OP, as a similar approach might be applied later.
Stephen23
Stephen23 2021년 5월 30일
편집: Stephen23 2021년 5월 30일
"... however it might be a useful point to note for OP, as a similar approach might be applied later"
By definition, superfluous code never needs to "be applied later", and usually indicates a misunderstanding of MATLAB.

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Matrix Indexing에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by