VERY simple question about adding 2 matrices

Matrix A and B have the same size: 512 x 512 x 105.
I want each element of matrix A to be equal to the corresponding element in matrix B when that element in matrix B is greater than zero.
How can I write this without a for loop?
Thank you very much!!

 採用された回答

Walter Roberson
Walter Roberson 2014 年 3 月 17 日

0 投票

A(B>0) = B(B>0);

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeCreating and Concatenating Matrices についてさらに検索

製品

質問済み:

2014 年 3 月 17 日

コメント済み:

2014 年 3 月 17 日

Community Treasure Hunt

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

Start Hunting!

Translated by