MATLAB: VERY simple question about adding 2 matrices

MATLABmatrix arraymatrix manipulation

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!!

Best Answer

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