Put array data inside another array without a for cycle

1 view (last 30 days)
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?

Accepted Answer

Guillaume
Guillaume on 18 Dec 2017
Very simply:
array2(array1 == 0) = 0

More Answers (0)

Categories

Find more on Operators and Elementary Operations in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!