Obtaining a logic vector (?) from a logic array

조회 수: 1 (최근 30일)
Mert Emrem
Mert Emrem 2021년 10월 24일
댓글: Mert Emrem 2021년 10월 24일
A v
[0 0 0 0] |0|
[1 0 0 0] |1|
[1 1 0 1] -> |1|
[0 0 0 0] |0|
[0 1 1 0] |1|
What I am looking for: n'th element of column vector v is 1 if any member of n'th row of the array A, if else 0.

채택된 답변

the cyclist
the cyclist 2021년 10월 24일
A = [0 0 0 0;
1 0 0 0;
1 1 0 1;
0 0 0 0;
0 1 1 0];
v = any(A,2)
v = 5×1 logical array
0 1 1 0 1

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Matrices and Arrays에 대해 자세히 알아보기

제품


릴리스

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by