VERY simple question about adding 2 matrices

1 Ansicht (letzte 30 Tage)
Mohsen
Mohsen am 17 Mär. 2014
Kommentiert: Mohsen am 17 Mär. 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!!

Akzeptierte Antwort

Walter Roberson
Walter Roberson am 17 Mär. 2014
A(B>0) = B(B>0);

Weitere Antworten (0)

Kategorien

Mehr zu Matrix Indexing finden Sie in Help Center und File Exchange

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by