Finding row entries that are not equal?

14 vues (au cours des 30 derniers jours)
Andrew Miller
Andrew Miller le 4 Juin 2020
Commenté : Andrew Miller le 4 Juin 2020
Hello everyone,
I have a matrix and I would like to find all of the rows such that the entry in the first column does not match the entry of the second column.
Background: I am running some finite element code. I am finding all entries of the stiffness matrix that are positive, but in particular I want to find the stiffness matrix off-diagonal entries that are positive.
Thank you in advanced!
Andrew

Réponse acceptée

madhan ravi
madhan ravi le 4 Juin 2020
matrix(:,1) ~= matrix(:,2)
  1 commentaire
Andrew Miller
Andrew Miller le 4 Juin 2020
Thank you. If I set this to a l=matrix(:,1) ~= matrix(:,2), then I can find(l==1) will give back the entries desired.
Thanks!

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Mathematics dans Help Center et File Exchange

Produits


Version

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by