How to Find average value for every 10 sets of a matrix

1 回表示 (過去 30 日間)
Magdy Ismail
Magdy Ismail 2021 年 1 月 15 日
コメント済み: Mischa Kim 2021 年 1 月 15 日
I have a one dimensional array A of 1000 elements.
How do I calculate the mean of elements for the first 10 sets ,then the second sets, and third sets so on until 1000

採用された回答

Mischa Kim
Mischa Kim 2021 年 1 月 15 日
Hi Magdy, you could use something like:
x = 1:1:12; % this would be your matrix A
y = reshape(x,3,4)
m = mean(y,1)
  2 件のコメント
Magdy Ismail
Magdy Ismail 2021 年 1 月 15 日
Thank you so much so for an example if i have like 1000 numbers
the code should be like this
x = 1:1:1000; % this would be your matrix A
y = reshape(x,10,100 )
m = mean(y,1)
Right? this will give me the average for each 10 sets?
Mischa Kim
Mischa Kim 2021 年 1 月 15 日
Exactly.

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeStatistics and Machine Learning Toolbox についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by