Array cell : return true if an element is >m

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Array cell : return true if an element is >m

LucaLuca
hi,


i've the following array cell


bg =
{
  [1,1] = -30
  [1,2] = 4
  [1,3] = -1
  [1,4] =  5
  [1,5] =  4
  [1,6] = 31
  [1,7] = -1
  [1,8] = -1
  [1,9] = 18
  [1,10] = -1
  [1,11] = -1
}

i want a code return true if one element >m





--
Sent from: http://octave.1599824.n4.nabble.com/Octave-General-f1599825.html


Reply | Threaded
Open this post in threaded view
|

Re: Array cell : return true if an element is >m

Ian McCallion
sum(cell2mat(bg)>m)

is the number of such elements. Please cope with the remainder of your problem yourself.

Ian


On 20 July 2018 at 17:26, LucaLuca <[hidden email]> wrote:
hi,


i've the following array cell


bg =
{
  [1,1] = -30
  [1,2] = 4
  [1,3] = -1
  [1,4] =  5
  [1,5] =  4
  [1,6] = 31
  [1,7] = -1
  [1,8] = -1
  [1,9] = 18
  [1,10] = -1
  [1,11] = -1
}

i want a code return true if one element >m





--
Sent from: http://octave.1599824.n4.nabble.com/Octave-General-f1599825.html