On Mon, 21 Jun 2010 18:03:52 +0000, Bruce Bowler set fingers to keyboard
and typed:
> On Mon, 21 Jun 2010 17:44:10 +0000, Pink Panther set fingers to
> keyboard and typed:
>
>> "someone" <someone@somewhere.net> wrote in message
>> <hvo6p7$o14$1@fred.mathworks.com>...
>>> "Pink Panther " <huguesrialan@gmail.com> wrote in message
>>> <hvo5r6$o05$1@fred.mathworks.com>...
>>> > hi, sorry for this beginner question : in a matrix I have one line
>>> > with 'results', I'd like to calculate the ratio of results > 0 to
>>> > all results. is there a simple/elegant way of doing that ? thanks
>>>
>>> Not sure what you wnat to do.
>>> Can you provide a specific example?
>>> What does "one line with 'results'" mean?
>>
>> the word 'result' might be misleading. just consider we have a one line
>> vector, with numbers positive and negative, I'd like to calculate the
>> proportion of numbers >0 to those <0. so for a serie like [6 3 2 0 0
>> 0] the answer would be 2 / 1 = 2
>
> a = [6 3 2 0 0 0];
> sum(a>0)/sum(a<0)
PS. Don't forget to check that there *are* elements < 0 before you try
this :)

+++
Bruce Bowler  Selfrespect is the secure feeling that no one, as
1.207.633.9610  yet, is suspicious.
bbowler@bigelow.org   H. L. Mencken
+++
