title: Accept only one keypress for a certain period of time in Matlab
body: <p>I have a simple, sort of GUI code shown below. 
  This "test_keypress" function creates a figure, and it responses to the keypress (space). </p>
  
  <p>Now, I want to add a constraint so that Matlab accepts only one keypress for a certain period of time (say, 1 second). 
  In other words, I want to reject a keypress if it happens within 1 sec after the previous keypress occurred. </p>
  
  <p>How can I do that? </p>
  
  <pre><code>function test_keypress
  
  f = figure;
  set(f,'KeyPressFcn',@figInput);
  imshow(ones(200,200,3));
  
  end
  
  
  function figInput(src,evnt)
  
  if strcmp(evnt.Key,'space')
      imshow(rand(200,200,3));
  end
  
  end
  </code></pre>