MATLAB: 10 minutes average for four hours data

MATLABreshape

3793.197 3793.19735 3793.1977 3793.19805 3793.1984 3793.19875 3793.1991 3793.19945 3793.1998 3793.20015 3793.2005 3793.20085 3793.2012 3793.20155 3793.2019 3793.20225 3793.2026 3793.20295 3793.2033 3793.20365 3793.204 3793.20435……..etc i have a data set for four hours….these datas are taken in 15 seconds interval and for four hours i will have 720 datas …..for the first hour i need to calculate average for first 10 minutes and remaining 50 minutes no need to calculate average and again for second hour, first 10 minutes i need to calculate average and so on til the completion of four hours…….since i m a beginner in matlab …..i need a help sir to write a matlab code for 10 minutes average for four hours data….

Best Answer

nHours = 4; %number of hours
Ts = 15; %sampling period [s]
data = [3793.197... %your data is 960x1 size
%data = rand(nHours*3600/Ts,1); %test data (4hours*3600second/15second)
meanT = 10*60; %test period [s]
matrix = reshape(data,3600/Ts,nHours);
out = mean(matrix(1:meanT/Ts,:));