Calculating an average in an n x m array that contain zeros

How can i calculate an average in an array where data in the columns are zero values and I don't want the zero to be considered when computig an average.
For example: A= [2 2 ; 2 4; 1 0] >>> mean(A) results in 1.667 2 >>>the answer I want is 1.667 3
Any assistance is much appreciated.

 採用された回答

その他の回答 (0 件)

カテゴリ

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by