NaN data treatment: can I get a mean f a vector including NaN?
조회 수: 2 (최근 30일)
이전 댓글 표시
Hello,
The title says it all. Can I get a mean of a vector including NaN? For instance, a= [1 2 3 NaN 4 5] mean(a) usually gives NaN. But I wonder if there is any command or way to get a mean of 3 there. 1. NaN is treated to be missing so that is counted as zero and 2. 1+2+3+4+5 is divided by 5 not by six, which counts NaN.
Thanks
댓글 수: 0
답변 (1개)
Walter Roberson
2012년 2월 18일
nanmean() if you have the stats toolbox. If you do not there is a File Exchange Contribution with a title similar to "nantools"
참고 항목
카테고리
Help Center 및 File Exchange에서 NaNs에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!