Effacer les filtres
Effacer les filtres

Extract overlay matrix containing the same number

4 vues (au cours des 30 derniers jours)
Phat Pumchawsaun
Phat Pumchawsaun le 11 Fév 2018
Hi,
I have two matrix as example below
A=
[0 1 2
3 4 5
0 9 0]
B=
[0 1 4
3 0 5
0 9 1]
I want to extract only overlay cell containing the same number as following;
C=
[0 1 0
3 0 5
0 9 0]
Could you please help me for that
Thanks Phat

Réponses (1)

John D'Errico
John D'Errico le 11 Fév 2018
Easy peasy, the MATLAB way.
C = A.*(A == B);

Catégories

En savoir plus sur Matrices and 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