Put array data inside another array without a for cycle

1 Ansicht (letzte 30 Tage)
Dario
Dario am 18 Dez. 2017
Beantwortet: Guillaume am 18 Dez. 2017
I have 2 array of equal dimension: 1440000x1. I need to put in the 2nd array the value 0 when there is the value 0 in the first array (in the same position). There is a quick way to do this not using a for cycle?

Akzeptierte Antwort

Guillaume
Guillaume am 18 Dez. 2017
Very simply:
array2(array1 == 0) = 0

Weitere Antworten (0)

Kategorien

Mehr zu Operators and Elementary Operations finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by