How to mean all array?
조회 수: 3 (최근 30일)
이전 댓글 표시
Hi, im using matlab r2018a
lets say i have array
A = [NaN 1 1; 2 NaN 2; 1 NaN 2; 4 2 2]
how to get mean of all of it?
i need the result is 1.888889
i try using
z = mean(A(:))
but the answer is
z = NaN
댓글 수: 0
채택된 답변
추가 답변 (1개)
Walter Roberson
2021년 6월 16일
format long g
A = [NaN 1 1; 2 NaN 2; 1 NaN 2; 4 2 2]
mean(A, 'all', 'omitnan')
참고 항목
카테고리
Help Center 및 File Exchange에서 Logical에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!