MATLAB Answers

How can I calculate the mean of a line and put it into a new vector?

조회 수: 3(최근 30일)
Max Behr
Max Behr 22 Apr 2020
댓글: Max Behr 22 Apr 2020
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
Steven Lord 22 Apr 2020
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

  댓글 수: 1

Max Behr
Max Behr 22 Apr 2020
Thanks, I found it out. Thanks.

댓글을 달려면 로그인하십시오.

제품


릴리스

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by