title: Stop a infinite while loop pressing a key in Matlab
body: <p>I have a while loop, infinite, and I want to stop it when I press a keyboard key.</p>
  
  <p>Pseudocode:</p>
  
  <pre><code>While(1)
      do stuff;
  
      listening for key;
      if key is pressed
          break;
      end
  end
  </code></pre>
  
  <p>The function <code>waitforbuttonpress</code> makes me press the key, so no luck. </p>
  
  <p>I've found no option on the web.</p>