Extract values common to 5 columns
Afficher commentaires plus anciens
Hi, I have a matrix A with 5 columns (1 to 5). I want to compare columns 1 through 5 and then extract values common to all 5 columns. Put the extracted values (common to all 5 columns) into a separate matrix called Match. Thank you!
4 commentaires
James Tursa
le 24 Jan 2020
What have you done so far? What specific problems are you having with your code?
Curious Mind
le 24 Jan 2020
Modifié(e) : Curious Mind
le 24 Jan 2020
Star Strider
le 24 Jan 2020
Is this homework? If so we can only give hints.
If it is not homework, I will post my general solution.
Curious Mind
le 24 Jan 2020
Réponse acceptée
Plus de réponses (1)
James Tursa
le 24 Jan 2020
0 votes
Hint: Look at the result of diff(A,[],2). If all the values in a row are equal, what would you expect to be in the result of this diff calculation? Can you devise a test base on this result to see if every value in a row is the same?
Catégories
En savoir plus sur Matrices and Arrays dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!