Path: news.mathworks.com!not-for-mail
From: "Mohammad Monfared" <gohardoust@gmail.com>
Newsgroups: comp.soft-sys.matlab
Subject: Re: How to do this in the vector form?
Date: Wed, 21 Jan 2009 19:41:02 +0000 (UTC)
Organization: gol
Lines: 20
Message-ID: <gl7toe$sov$1@fred.mathworks.com>
References: <gl7i56$pei$1@fred.mathworks.com> <gl7ive$nrj$1@fred.mathworks.com> <a_Jdl.18329$Ew6.17698@newsfe22.iad>
Reply-To: "Mohammad Monfared" <gohardoust@gmail.com>
NNTP-Posting-Host: webapp-05-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1232566862 29471 172.30.248.35 (21 Jan 2009 19:41:02 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Wed, 21 Jan 2009 19:41:02 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 93829
Xref: news.mathworks.com comp.soft-sys.matlab:513018


Walter Roberson <roberson@hushmail.com> wrote in message <a_Jdl.18329$Ew6.17698@newsfe22.iad>...
> Matt wrote:
> > "Mohammad Monfared" <gohardoust@gmail.com> wrote in message <gl7i56$pei$1@fred.mathworks.com>...
> 
> >> I have a 12 by 200 matrix, say A. I'd like to compute the mean values of each row for
> >> non-zero elements.
> 
> > sum(A,2)./sum(A~=0,2)
> 
> That solution leads to unexpected results if an entire row is all-zero. On the other
> hand, the original poster didn't say what should be done in that case...
> 
> -- 
> .signature note: I am now avoiding replying to unclear or ambiguous postings.
> Please review questions before posting them. Be specific. Use examples of what you mean,
> of what you don't mean. Specify boundary conditions, and data classes and value
> relationships -- what if we scrambled your data or used -Inf, NaN, or complex(rand,rand)?

Yes you are right!
I was thinking a way using 'trimmean' function in a vector form. It seems I should write a function and check for occasions.