title: matlab: "Index of element to remove exceeds matrix dimensions." When I am not removing any elemens
body: <p>I get the error </p>
  
  <pre><code>???  Index of element to remove exceeds matrix dimensions.
  
  Error in ==&gt; myfile at 111
      C(i)=s{i,3};
  </code></pre>
  
  <p>the code being:</p>
  
  <pre><code>C=zeros(num_of_tris,1);
  for i=1:size(C,1)
      C(i)=s{i,3};
  end
  </code></pre>
  
  <p>I'm not showing the code for creating <code>s</code>, but I assume it's beside the point as <code>s</code> only appears on the right hand side of the assignment...</p>
  
  <p>why does it say <code>element to remove</code>? which element am I removing?</p>