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
 

MATLAB Central Terms of Use

NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Terms prior to use.

Contact us at files@mathworks.com