フィルターのクリア

Extract overlay matrix containing the same number

4 ビュー (過去 30 日間)
Phat Pumchawsaun
Phat Pumchawsaun 2018 年 2 月 11 日
回答済み: John D'Errico 2018 年 2 月 11 日
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

回答 (1 件)

John D'Errico
John D'Errico 2018 年 2 月 11 日
Easy peasy, the MATLAB way.
C = A.*(A == B);

カテゴリ

Help Center および File ExchangeMatrices and Arrays についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by