How do I find the average of all rows across a series of columns?

2 次查看(过去 30 天)
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!

采纳的回答

Birdman
Birdman 2018-4-25
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.

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Resizing and Reshaping Matrices 的更多信息

标签

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by