How do I automate adding columns together
Show older comments
I have a large data matrix (513*63)
I want to add each column together and then divide them to create a single vector.
At the moment all I can think of is
matrix = 513x63
column_one= [matrix(:,1)]
column_two= [matrix(:,2)]
column_three= [matrix(:,3)]
vector_variable = column_one + column_two + column_three/3
Is there a way that I can automate this process to loop over 63 columns?
1 Comment
Walter Roberson
on 9 May 2022
Are you wanting to take the mean of the 63 sums?
Are you wanting to take 11 groups, 1:3, 4:6 and so on?
Are you wanting to take a moving mean of adjacent groups of 3, 1:3, 2:4, 3:5 and so on?
Accepted Answer
More Answers (0)
Categories
Find more on Creating and Concatenating Matrices in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!