VERY simple question about adding 2 matrices

1 visualización (últimos 30 días)
Mohsen
Mohsen el 17 de Mzo. de 2014
Comentada: Mohsen el 17 de Mzo. de 2014
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!!

Respuesta aceptada

Walter Roberson
Walter Roberson el 17 de Mzo. de 2014
A(B>0) = B(B>0);

Más respuestas (0)

Categorías

Más información sobre Multidimensional Arrays en Help Center y File Exchange.

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by