title: Errors running script from command window MATLAB but not from run icon
body: <p>I have a function file which contains a GUI.</p>
  
  <p>Whenever I run (compile) the file using the green run logo in MATLAB it successfully builds. Whenever I try to run it from the command window i.e: <code>run(MyFile);</code>I get this error but the file still builds correctly:</p>
  
  <pre><code>??? Error using ==&gt; fileparts at 31
  Input must be a row vector of characters.
  
  Error in ==&gt; run at 25
  [p,s,ext] = fileparts(script);
  </code></pre>
  
  <p>I'm not getting the error when I hit 'run' in the text editor.</p>
  
  <p>Thoughts?</p>