logical operators on a logical matrix

48 vues (au cours des 30 derniers jours)
Pankaj
Pankaj le 13 Sep 2019
Commenté : Pankaj le 13 Sep 2019
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.

Réponse acceptée

madhan ravi
madhan ravi le 13 Sep 2019
all(A,2)
any(A,2)
  4 commentaires
madhan ravi
madhan ravi le 13 Sep 2019
Thanks Jos :)
Pankaj
Pankaj le 13 Sep 2019
thanks Jos

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Mathematics dans Help Center et File Exchange

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by