MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi
Learn moreOpportunities for recent engineering grads.
Apply TodayNew to MATLAB?
MATLAB Central > MATLAB Newsreader > Mean of nonzero elements in a 2D Array w/o a loop? 

Subject: Mean of nonzero elements in a 2D Array w/o a loop? From: Evan Date: 25 Jul, 2010 19:38:03 Message: 1 of 11 
I can't seem to figure out how to find the mean of the nonzero elements in the rows of a 2D array without using a for loop.. 
Subject: Mean of nonzero elements in a 2D Array w/o a loop? From: us Date: 25 Jul, 2010 19:46:09 Message: 2 of 11 
"Evan " <Evan@fake.com> wrote in message <i2i3qr$lb8$1@fred.mathworks.com>... 
Subject: Mean of nonzero elements in a 2D Array w/o a loop? From: Roger Stafford Date: 25 Jul, 2010 19:53:03 Message: 3 of 11 
"Evan " <Evan@fake.com> wrote in message <i2i3qr$lb8$1@fred.mathworks.com>... 
Subject: Mean of nonzero elements in a 2D Array w/o a loop? From: Roger Stafford Date: 25 Jul, 2010 19:55:29 Message: 4 of 11 
What I meant to say was convert the zeros to NaNs and then use nanmean. 
Subject: Mean of nonzero elements in a 2D Array w/o a loop? From: Roger Stafford Date: 25 Jul, 2010 20:03:03 Message: 5 of 11 
"Evan " <Evan@fake.com> wrote in message <i2i3qr$lb8$1@fred.mathworks.com>... 
Subject: Mean of nonzero elements in a 2D Array w/o a loop? From: Walter Roberson Date: 25 Jul, 2010 20:17:04 Message: 6 of 11 
Roger Stafford wrote: 
Subject: Mean of nonzero elements in a 2D Array w/o a loop? From: us Date: 25 Jul, 2010 20:19:03 Message: 7 of 11 
"Roger Stafford" <ellieandrogerxyzzy@mindspring.com.invalid> wrote in message <i2i59n$mat$1@fred.mathworks.com>... 
Subject: Mean of nonzero elements in a 2D Array w/o a loop? From: Evan Date: 25 Jul, 2010 20:50:04 Message: 8 of 11 
Thanks for such quick responses, 
Subject: Mean of nonzero elements in a 2D Array w/o a loop? From: Roger Stafford Date: 25 Jul, 2010 20:52:03 Message: 9 of 11 
"us " <us@neurol.unizh.ch> wrote in message <i2i67n$kjm$1@fred.mathworks.com>... 
Subject: Mean of nonzero elements in a 2D Array w/o a loop? From: Evan Date: 25 Jul, 2010 20:53:03 Message: 10 of 11 
As always, I replied too soon. 
Subject: Mean of nonzero elements in a 2D Array w/o a loop? From: Doug Schwarz Date: 25 Jul, 2010 22:26:05 Message: 11 of 11 
In article <i2i85j$k1h$1@fred.mathworks.com>, 
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.