title: MATLAB - "clear -except a" only deletes a
body: <p>Everywhere I look it says that the expression clear <code>-except a</code> should clear all variables except for <code>a</code>. However, if I try it (MATLAB R2014a, running on Linux Mint 17 Cinnamon 64-bit), matlab clears only the variable <code>a</code> ("-except a" is shown in purple, apparently being processed as a string). I tried <code>clear('-except a')</code>, which does not do anything, and 'clear - except a' - with a space between "-" and "except", which results in an error (too many arguments).</p>
  
  <p>What am I doing wrong?</p>
  
  <p>[edit]</p>
  
  <p>Here are the full errors I obtain for <code>clearvars</code>:</p>
  
  <pre><code>EDU&gt;&gt; a = 5;
  EDU&gt;&gt; clearvars -except a;
  Error using strjoin (line 14)
  Expected input to be one of these types:
  
  char
  
  Instead its type was cell.
  
  Error in clearvars&gt;createPattern (line 187)
      pattern = sprintf('(%s)$', strjoin(variableArgs, '|'));
  
  Error in clearvars (line 76)
      exceptVarPat = sprintf('(?!%s)', createPattern(exceptVarArgs, flags.regexpExcept));
  </code></pre>