How do I find the average of all rows across a series of columns?
2 views (last 30 days)
Show older comments
Carlie Jones-Hershinow
on 25 Apr 2018
Commented: Carlie Jones-Hershinow
on 25 Apr 2018
I am fairly new to Matlab so I'm sorry if this seems super obvious...
Have a matrix of 1000 rows, and 10 columns. How do I find the average across all the rows, and then save that column of averages into a new matrix? (this is in a loop)
EMGmatrix(:,j-1) = EMG_new; Average = mean(EMGmatrix(:,:);
Thanks!
0 Comments
Accepted Answer
Birdman
on 25 Apr 2018
You do not need a loop for this. Consider the following case:
A=randi([1 4],1000,10);%demo data
res=mean(A,2);
res variable contains the average of each row, which is 1000x1.
More Answers (0)
See Also
Categories
Find more on Resizing and Reshaping 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!