title: Break out of proprietary toolbox after a given time
body: <p>I am iterating through a large test matrix in MATLAB and calling second-party proprietary software (running in MATLAB) each time. I cannot edit the software source code. Sometimes, the software hangs, so I want to exit it after a certain amount of time and move on to the next iteration.</p>
  
  <p>In pseudocode, I'm doing this:</p>
  
  <pre><code>for i = 1:n
      output(i) = proprietary_software(input(i));
  end
  </code></pre>
  
  <p>How can I skip to the next iteration (and possibly save <code>output(i)='too_long'</code>) if the proprietary software is taking too long?</p>