title: MATLAB: Check if a value in a cell array remains the same
body: <p>My question may be a bit "silly", but I am stucked here, so I would really need your help.</p>
  
  <p>So, we have a cell array Q <em>5520x1</em>, like the one below:</p>
  
  <p><img src="https://i.stack.imgur.com/dbgM0.png" alt="enter image description here"></p>
  
  <p>I'm only interested in the first two numbers of each row. To be specifically clear, giving </p>
  
  <p>K>> Q{1}</p>
  
  <blockquote>
    <p>ans = 0     1     0   238</p>
  </blockquote>
  
  <p>I only care about 0 and 1, and so on with the other rows. <em>Only the first two numbers of each row.</em> Let's just ignore the rest values in each row of Q, they are more or less irrelevant.</p>
  
  <p>My problem is, how is it possible to check if the first value of each row in the cell array Q, in the example above 0, remains the same? What I would like to achieve, is <em>while the first value is the same, I want to store in another cell array, all the second values</em>. In case of number 0, I want to store the values</p>
  
  <blockquote>
    <p>[1,3,127,129,216,217,252,253,302,303,342,343]</p>
  </blockquote>
  
  <p>and so on. How could this be done?</p>
  
  <p>Any help or advice would be really appreciated.</p>