필터 지우기
필터 지우기

How to work with arrays with values of Log(0)?

조회 수: 13 (최근 30일)
Jacinto Elias Sedeño-Díaz
Jacinto Elias Sedeño-Díaz 2020년 12월 8일
답변: David Hill 2020년 12월 8일
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

답변 (1개)

David Hill
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

카테고리

Help CenterFile Exchange에서 Exponents and Logarithms에 대해 자세히 알아보기

태그

제품


릴리스

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by