looping a for loop through an array

3 visualizaciones (últimos 30 días)
Robert Bambil
Robert Bambil el 5 de Nov. de 2018
Respondida: Stephen23 el 5 de Nov. de 2018
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

Respuestas (1)

Stephen23
Stephen23 el 5 de Nov. de 2018
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

Categorías

Más información sobre Loops and Conditional Statements en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by