Prev: fzero logical error
Next: Read String To Structure
From: Pink Panther on 21 Jun 2010 13:00 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
From: someone on 21 Jun 2010 13:16 "Pink Panther " <huguesrialan(a)gmail.com> wrote in message <hvo5r6$o05$1(a)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?
From: Pink Panther on 21 Jun 2010 13:44 "someone" <someone(a)somewhere.net> wrote in message <hvo6p7$o14$1(a)fred.mathworks.com>... > "Pink Panther " <huguesrialan(a)gmail.com> wrote in message <hvo5r6$o05$1(a)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
From: Bruce Bowler on 21 Jun 2010 14:03 On Mon, 21 Jun 2010 17:44:10 +0000, Pink Panther set fingers to keyboard and typed: > "someone" <someone(a)somewhere.net> wrote in message > <hvo6p7$o14$1(a)fred.mathworks.com>... >> "Pink Panther " <huguesrialan(a)gmail.com> wrote in message >> <hvo5r6$o05$1(a)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) -- +-------------------+---------------------------------------------------+ Bruce Bowler | After two years in Washington, I often long for 1.207.633.9610 | the realism and sincerity of Hollywood. bbowler(a)bigelow.org | - Fred Thompson +-------------------+---------------------------------------------------+
From: Bruce Bowler on 21 Jun 2010 14:08 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(a)somewhere.net> wrote in message >> <hvo6p7$o14$1(a)fred.mathworks.com>... >>> "Pink Panther " <huguesrialan(a)gmail.com> wrote in message >>> <hvo5r6$o05$1(a)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 | Self-respect is the secure feeling that no one, as 1.207.633.9610 | yet, is suspicious. bbowler(a)bigelow.org | - H. L. Mencken +-------------------+---------------------------------------------------+
|
Pages: 1 Prev: fzero logical error Next: Read String To Structure |