フィルターのクリア

getting the mean EXCEPT zero entries

2 ビュー (過去 30 日間)
cgo
cgo 2018 年 11 月 9 日
コメント済み: madhan ravi 2018 年 11 月 9 日
I have a matrix, M = [zeros(10,10); 1 , 2 , 3 ,4 ,5,6,7,8,9,10];
I want to get the mean of each column, except the zero terms. How do I do this?

回答 (1 件)

Fangjun Jiang
Fangjun Jiang 2018 年 11 月 9 日
M=zeros(5);
M(randi(25,10,1))=1:10;
M(M==0)=nan;
mean(M,'omitnan')
  1 件のコメント
madhan ravi
madhan ravi 2018 年 11 月 9 日
+1 made it clear

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeData Types についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by