comparing double array to logical array

조회 수: 8 (최근 30일)
Engineer Undergoing
Engineer Undergoing 2021년 8월 9일
댓글: Engineer Undergoing 2021년 8월 9일
Hello
I am trying to compare two arrays and the save the results in a new one (third), the first array is 1000x1 double array and the second array is 1000x1 logical array. I'd like to compare them to each other, meaning for every true value (1) in the logical array I'd get the corresponding value of the double array (first array) saved in the new array (third array).
How can I do that? I tried looking up for that on the " Relational Operations" but I could'nt find something relevant, Should I do an if condition statement and how?

채택된 답변

Walter Roberson
Walter Roberson 2021년 8월 9일
result = DoubleArray(LogicalArray);
Logical indexing.
  댓글 수: 1
Engineer Undergoing
Engineer Undergoing 2021년 8월 9일
worked like a charm, I didn't expect it to be this simple
Thanks

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Matrix Indexing에 대해 자세히 알아보기

제품


릴리스

R2016b

Community Treasure Hunt

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

Start Hunting!

Translated by