title: Matlab 'exist' returns 0 for a file that definitely exists!
body: <p>I'm running Matlab 7.8.0 under Windows.</p>
  
  <p>I am calling an external utility using <code>dos()</code> which creates a file in the current directory.
  I the file is created correctly, but it cannot be seen by <code>exist</code> or <code>fopen</code>, which return <code>0</code> and <code>-1</code> respectively. The filename is correct!</p>
  
  <pre><code>&gt;&gt; pwd
  ans = 
  I:\
  
  &gt;&gt; ls
  
  file1.asc     file2.asc     file3.asc
  
  &gt;&gt; exist('file1.asc')           % this file was there before
  ans =
       2
  
  &gt;&gt; exist('file2.asc')           % this file is newly created
  ans =
       0
  </code></pre>
  
  <p>to confirm it's not an odd/problematic filename, I checked from a Cygwin shell:</p>
  
  <pre><code>/cygdrive/i/ $ if [ -f file2.asc ]; then echo "OK"; fi
  OK
  </code></pre>
  
  <p>So the file is good. I tried renaming it</p>
  
  <pre><code>/cygdrive/i/ $ mv file2.asc test
  </code></pre>
  
  <p>and in Matlab</p>
  
  <pre><code>&gt;&gt; ls
  
  file1.asc      file3.asc      test
  
  &gt;&gt; exist('test')
  ans =
       0
  </code></pre>
  
  <p>If I exit and restart Matlab it works fine. But I need to dynamically create the file and then access it!</p>