Effacer les filtres
Effacer les filtres

How do I check to see if the elements in a matrix are all equal?

53 vues (au cours des 30 derniers jours)
katherine keogh
katherine keogh le 11 Sep 2020
Commenté : madhan ravi le 11 Sep 2020
So if I have matrix A=[1 1 1 ; 1 1 1 ; 1 1 1] I would like to run a check so check if all the elements in the matrix are the same. Or say matrix B = [1, 0 1; 0 1 0; 1 1 0] I would liek to run a check to see if the elements are all the same ( in this case they aren't).

Réponse acceptée

madhan ravi
madhan ravi le 11 Sep 2020
a = num2cell(A);
isequal(a{:})

Plus de réponses (0)

Catégories

En savoir plus sur Cell Arrays dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by