Thread Subject: mean of a single column?

Subject: mean of a single column?

From: Michael

Date: 12 Sep, 2008 13:22:01

Message: 1 of 4

I know I can find the mean of the all the rows and colums of a matrix with

X =

     1 2 3
     3 4 6

mean (X,1) % column
mean (X,2) % row

What is the command to find the mean of a single column within a matrix?

Subject: mean of a single column?

From: Christian Zietz

Date: 12 Sep, 2008 13:38:48

Message: 2 of 4

Michael schrieb:

> What is the command to find the mean of a single column within a matrix?

Are you looking for

mean(X(:,1))

Christian
--
Christian Zietz - CHZ-Soft - czietz (at) gmx.net
WWW: http://www.chzsoft.com.ar/
PGP/GnuPG-Key-ID: 0x6DA025CA

Subject: mean of a single column?

From: someone

Date: 12 Sep, 2008 13:41:01

Message: 3 of 4

"Michael " <michael.lisowski@gentex.com.extrachar> wrote in message <gadqdp$ekv$1@fred.mathworks.com>...
> I know I can find the mean of the all the rows and colums of a matrix with
>
> X =
>
> 1 2 3
> 3 4 6
>
> mean (X,1) % column
> mean (X,2) % row
>
> What is the command to find the mean of a single column within a matrix?

>> X = [1 2 3 ; 4 5 6]

X =

     1 2 3
     4 5 6

>> avgX1 = mean(X(:,1))

avgX1 =

    2.5000

>> avgX2 = mean(X(:,2))

avgX2 =

    3.5000

% etc ...

Subject: mean of a single column?

From: Michael

Date: 12 Sep, 2008 13:58:02

Message: 4 of 4

Thanks. That did the trick. I thought I tried that but whatever.


>
> mean(X(:,1))

Tags for this Thread

Add a New Tag:

Separated by commas
Ex.: root locus, bode

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.

rssFeed for this Thread

Contact us at files@mathworks.com