Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: mean of a single column?
Date: Fri, 12 Sep 2008 13:41:01 +0000 (UTC)
Organization: Mitre Corp
Lines: 34
Message-ID: <gadrhd$t5p$1@fred.mathworks.com>
References: <gadqdp$ekv$1@fred.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: webapp-03-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1221226861 29881 172.30.248.38 (12 Sep 2008 13:41:01 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Fri, 12 Sep 2008 13:41:01 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 2318
Xref: news.mathworks.com comp.soft-sys.matlab:489984



"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 ...