Average of every 25 rows in a table
Show older comments
Hello,
I have a table of 10 columns and 1000 rows. I would like to take the average of each column for every 25 rows. How to code that please?
Thank you
Accepted Answer
More Answers (1)
Akira Agata
on 3 Jul 2022
Edited: Akira Agata
on 3 Jul 2022
Another possible solution:
% Sample data
data = rand(1000, 10);
% Grouping
group = repelem(1:size(data, 1)/25, 25)';
% Apply mean function for each group
output = splitapply(@mean, data, group);
3 Comments
Reem RA
on 4 Jul 2022
Akira Agata
on 4 Jul 2022
I just wanted to create "group number".
For more information, please take a look at the following.
Reem RA
on 5 Jul 2022
Categories
Find more on Tables in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!