title: remove rows of matrix in matlab
body: <p>If I have a matrix <code>X</code> with only one column and it has some negative values in some rows. How can I remove only the negative values?</p>
  
  <p>Example:</p>
  
  <pre><code>X=[-1; 2; 3; -4; 5]
  </code></pre>
  
  <p>should become:</p>
  
  <pre><code>X=[2; 3; 5]
  </code></pre>
  
  <p>Also, how can I remove values from </p>
  
  <pre><code>y=[1; 2; 3; 4; 5]
  </code></pre>
  
  <p>based on where the negative values in <code>X</code> are found? <code>y</code> should be <code>[2; 3; 5]</code> after this operation.</p>