looping a for loop through an array

i need to index through the array taking the mean of 12 elements sequentially. so the array is 105120X1 and I need to go through it storing each hr as the mean of the 12 elements in the second array

回答 (1 件)

Stephen23
Stephen23 2018 年 11 月 5 日

0 投票

Where V is your 105120X1 vector of data:
mean(reshape(V,12,[]),1);
And checking using random data:
>> V = randi(999,105120,1);
>> M = mean(reshape(V,12,[]),1);
>> M(1)
ans = 454.50
>> mean(V(1:12))
ans = 454.50

カテゴリ

ヘルプ センター および File ExchangeLoops and Conditional Statements についてさらに検索

タグ

質問済み:

2018 年 11 月 5 日

回答済み:

2018 年 11 月 5 日

Community Treasure Hunt

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

Start Hunting!

Translated by