VERY simple question about adding 2 matrices

1 次查看(过去 30 天)
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
A(B>0) = B(B>0);

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Matrix Indexing 的更多信息

产品

Community Treasure Hunt

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

Start Hunting!

Translated by