title: Break nested loop
body: <p>I have three nested loop in Matlab and in each loop, I have an "if" that check a flag. If it was OK, the the algorithm proceeds, otherwise, I want that the program should be terminated. Here is my codes, I think something is wrong!</p>
  
  <pre><code>[A] = finction (...,...,...)
  
  for i = 1:100
  for j = 1:100
  for k = 1:30
  
  some operation which its results is a flag
  
  if flag==1 % its initial value is 0
  break
  end;
  end;
  end;
  end;
  </code></pre>
  
  <p>Where is should put that break in order I break the rest of the computations?</p>