필터 지우기
필터 지우기

Compute Mode of values in array greater than 0

조회 수: 5 (최근 30일)
Tyler Smith
Tyler Smith 2018년 9월 17일
댓글: Tyler Smith 2018년 9월 17일
I need to compute the mode from values in my array (9x9 array) greater than 0. This is because I only care about the values greater than 0 and 0 will more often than not be the mode. Any suggestions would be great. Thanks!

채택된 답변

Stephan
Stephan 2018년 9월 17일
편집: Stephan 2018년 9월 17일
Hi,
here is a workaround using the properties of NaN :
A = [0 0 5; 0 0 0; 1 1 0;];
B=A;
B(A==0) = NaN;
res = mode(B);
disp(res)
Best regards
Stephan

추가 답변 (0개)

카테고리

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

태그

Community Treasure Hunt

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

Start Hunting!

Translated by