title: How to break out of a switch in octave?
body: <p>It seems to be that in <code>octave</code> (and perhaps also <code>matlab</code>) there is no way to break out of a <code>switch</code> statement, but I am not sure...</p>
  
  <pre><code>P=rand(2,20);
  mu=mean(P,2);
  dim=2;
  plot_mean=false;
  
  for i=1:1
  
  switch (dim)
  case 2
          % Print points as dots
          plot(P(1,:),P(2,:),'.');
          if (!plot_mean)
                  break;
          endif
          hold on
          % Print mean values as red circles
          plot(mu(1,:),mu(2,:),'or');
          % Quite some more code following here with again several if statements that need to be broken out
  case 3
          % Similar for 3D case
          % ...
  endswitch
  
  endfor
  </code></pre>
  
  <p>I just made this question into a full <code>octave</code> program, feel free to replace the <code>plot</code> functionality with other function calls. What is important is that I added a <code>for</code> loop around it from <code>1:1</code> and use <code>break</code>, but this is of course just a trick!</p>
  
  <p>What is the normal way to break out of <code>switch</code> in <code>octave</code>?</p>