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

2 ビュー (過去 30 日間)
Carlie Jones-Hershinow
Carlie Jones-Hershinow 2018 年 4 月 25 日
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 Center および File ExchangeResizing and Reshaping Matrices についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by