how to calculat average value for array?

1 回表示 (過去 30 日間)
janny
janny 2014 年 11 月 9 日
コメント済み: janny 2014 年 11 月 9 日
i have array (one column) as [12,17,25,30,6] i want to calculate the average value between minimum number and maximum number within the array, and the result should be positive number as if the average is 15.23 it should exclude the decimal fraction 0.23 and give the result as 15.

採用された回答

Guillaume
Guillaume 2014 年 11 月 9 日
mean to calculate average.
round, fix, ceil or floor to round your number depending on the rounding mode you want.
min and max to find the minimum and maximum
Is this what you want:
v = [12 17 25 30 6]';
round(mean([min(v) max(v)]))
  1 件のコメント
janny
janny 2014 年 11 月 9 日
thanks man....

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

その他の回答 (0 件)

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by