logical operators on a logical matrix

조회 수: 34 (최근 30일)
Pankaj
Pankaj 2019년 9월 13일
댓글: Pankaj 2019년 9월 13일
Consider the following logical matrix of 4X2
A = logical([1, 0; 1, 1; 0, 0; 0, 1])
I would like to apply logical operator (say `or`, `and`) on the matrix row wise so the result is 4X1 vector. (the matrix could of any dimension say mXn, and I want mX1 as output). The `or` operator requires two matrices for comparision, how to do it for single matrix.

채택된 답변

madhan ravi
madhan ravi 2019년 9월 13일
all(A,2)
any(A,2)
  댓글 수: 4
madhan ravi
madhan ravi 2019년 9월 13일
Thanks Jos :)
Pankaj
Pankaj 2019년 9월 13일
thanks Jos

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

추가 답변 (0개)

카테고리

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

제품

Community Treasure Hunt

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

Start Hunting!

Translated by