title: MATLAB debugging: smarter way to stop the code with an specific condition?
body: <p>When I debug long pieces of numerical code, often I want to see the function variable values if something happens, or in an specific iteration. Generally I do:</p>
  
  <pre><code>function banana(platano)
  
  % long stuff here
  
  for ii=1:123456789
       % tons of maths
     if ii==45612
        stophere=1;    % I put a break point in this line of code
     end
  end
  </code></pre>
  
  <p>However, this requires me to write code in the function for debugging and it doesn't look nice. Is there a smarter way of doing this?</p>