Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.matlab

Topic: Mean with condition
Replies: 3   Last Post: Nov 4, 2013 3:06 PM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Curious

Posts: 1,966
Registered: 12/6/04
Re: Mean with condition
Posted: Nov 4, 2013 10:06 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

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



Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.