Search All of the Math Forum:
Views expressed in these public forums are not endorsed by
Drexel University or The Math Forum.


Curious
Posts:
2,078
Registered:
12/6/04


Re: Mean with condition
Posted:
Nov 4, 2013 10:06 AM


"ProjectVOC " <c181683@drdrb.com> wrote in message <l58c8s$hcd$1@newscl01ah.mathworks.com>... > Hello, > > Here is my problem, i have a huge matrix. And i have to do the mean for a row but only with a condition, i created a logical vector which contain 1 when i want to include the value and 0 when i don't. > > For example > A=[2 3 4 5 0 > 6 7 8 9 1 > 7 5 1 2 1 > 2 5 6 9 0] > > And i want the mean for the second column when the 4th have a value of 1, so mean=6. > > Thanks for your help :)
I think you have to explain this a little better.
In the first paragraph you said "do the mean for a row..." Then in the last paragraph you said "want the mean for the second column..." Which is which? How do you get the mean to be 6 in your example?



