How to work with arrays with values of Log(0)?
조회 수: 19 (최근 30일)
이전 댓글 표시
I am working with arrays that include zero values. One transformation I must do is apply logarithms to each value in the matrix. In the result, I need to do other operations but I have to skip the values that do not have a result of the logarithm. How can I do that?
Thanks
댓글 수: 0
답변 (1개)
David Hill
2020년 12월 8일
a=log(initialArray);
idx=initialArray~=0;
a(idx)=5*a(idx);%other calculations only perform on non-zero values of initial array
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Logical에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!