title: Is it possible to stop a Simulink simulation when a certain condition is met?
body: <p>Assume that you have a Simulink simulation where a certain signal is first positive and after some time t in a given interval, it becomes negative. Your goal is to find the zero-crossing.</p>
  
  <p>A first approach would be to plot the signal over the given interval, save it and calculate the zero-crossing.</p>
  
  <p>When repeating this simulation numerous times for varying parameters, it would be beneficial to be able to stop the simulation after the signal has become negative. Then there is already enough information for the calculation of the zero-crossing in Matlab. How could you do that?</p>