MATLAB: Hi, I have 2 columns data, In that every 1 column data of 1000 value (like 1.2345). i have split this data into (1 to 30), (1 to 60),so on (1 to 990).

averagegroupssplitting datastatistics

manually it is very difficult to do it. and also find the average of that, means avg of (1 to 30), avg of (1 to 60) so on for statistical problem.please any one help me to solve using matlab.

Best Answer

Here is a way:
data = randi(10,20,1) % some data (20 points, rather than 1000, so easy to check)
n = 4:4:numel(data) % split from 1 to 4, from 1 to 8 etc (rather than 1:30, 1:60)
M = arrayfun(@(k) mean(data(1:k)), n) % engine