looping a for loop through an array

3 ビュー (過去 30 日間)
Robert Bambil
Robert Bambil 2018 年 11 月 5 日
回答済み: Stephen23 2018 年 11 月 5 日
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 日
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

カテゴリ

Help Center および File ExchangeLoops and Conditional Statements についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by