Array cell problem with operation scalar

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

Array cell problem with operation scalar

shivax
i've an array Cell

gt =
{
  [1,1] = -1
  [1,2] = -1
  [1,3] = -1
  [1,4] =  5
  [1,5] =  4
  [1,6] = -1
  [1,7] = -1
  [1,8] = -1
  [1,9] = -1
  [1,10] = -1
  [1,11] = -1
}

i try to execute :

if qt(4)>0
,...

i see this error :

error: binary operator '>' not implemented for 'cell' by 'scalar' operations

i think i give to convert cell Array in scalar

how can i do it? thanks







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


Reply | Threaded
Open this post in threaded view
|

Re: Array cell problem with operation scalar

Mike Miller-4
On Thu, Jul 19, 2018 at 12:57:20 -0500, shivax wrote:
> error: binary operator '>' not implemented for 'cell' by 'scalar' operations

You want to learn about the differences in cell array indexing.

    >> A = {-1, 0, 12, 3};
    >> A(3)
    ans =
    {
      [1,1] =  12
    }
    >> A{3}
    ans =  12

  https://octave.org/doc/interpreter/Indexing-Cell-Arrays.html

--
mike



signature.asc (849 bytes) Download Attachment