Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
elements in matrix

Subject: elements in matrix

From: areeba khan

Date: 14 Oct, 2011 17:35:30

Message: 1 of 2

how can i get the the mean of the elements of individual rows in a matrix?
say i have a 5x5 matrix, i need to have 5 means for 5 rows? i tried to do it using the sum command i.e. talking the sum of the elements and diving it by the total number of rows but the sum command returns the sum of all rows in a single row. similarly i can not use the mean function for the same reason. is there any command or function for the mentioned task?

Subject: elements in matrix

From: dpb

Date: 14 Oct, 2011 17:54:37

Message: 2 of 2

On 10/14/2011 12:35 PM, areeba khan wrote:
> how can i get the the mean of the elements of individual rows in a
> matrix? say i have a 5x5 matrix, i need to have 5 means for 5 rows? i
> tried to do it using the sum command i.e. talking the sum of the
> elements and diving it by the total number of rows but the sum command
> returns the sum of all rows in a single row. similarly i can not use the
> mean function for the same reason. is there any command or function for
> the mentioned task?

Yes, mean() will do it just fine--read the fine documentation on the use
of the optional direction argument.

--

Tags for this Thread

No tags are associated with this thread.

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us