How can I calculate the mean of a line and put it into a new vector?
1 回表示 (過去 30 日間)
古いコメントを表示
Hello,
asdasd
I got a matrix like this:
a(4,3)
a=
1 1 3
2 2 4
3 2 3
4 1 4
Now I would like to create another vector with the means of each line:
b(4,1)
b=
1,67
2,67
2,67
3
How can I do this with Matlab?
I tried this code but it only takes the first line...
b=mean(a)
Thanks for your help!
0 件のコメント
回答 (1 件)
Steven Lord
2020 年 4 月 22 日
Look at the description of the dim input argument in the documentation for the mean function. There's also a relevant example on that documentation page.
doc mean
参考
カテゴリ
Help Center および File Exchange で Get Started with MATLAB についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!