The Math Forum

Search All of the Math Forum:

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

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

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

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 ]

Posts: 2,359
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 " <> wrote in message <l58c8s$hcd$>...
> 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]

© The Math Forum at NCTM 1994-2018. All Rights Reserved.