Put array data inside another array without a for cycle

조회 수: 1 (최근 30일)
Dario
Dario 2017년 12월 18일
답변: Guillaume 2017년 12월 18일
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?

채택된 답변

Guillaume
Guillaume 2017년 12월 18일
Very simply:
array2(array1 == 0) = 0

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Operators and Elementary Operations에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by