title: Writing to file error: "Too many files open"
body: <p>I want to write the array <code>cloud</code> which is nothing abut a array storing the coordinates of a circular cloud with two columns, of latitude and longitude. I want these coordinates to be written on a text file in a manner like this.</p>
  
  <pre><code> 418.9517   43.9866
   419.2260   44.1501
   419.4826   44.3402
   419.7190   44.5550
   419.9327   44.7923
   420.1217   45.0497
  </code></pre>
  
  <p>With this code i want to generate multiple no of such files storing the coordinates of a single cloud in one file.  </p>
  
  <p>Here <code>a</code> is array with first two columns of latitude and longitude (center of circle) and the third one radius of the circle. And <code>z =size(a)</code>.(which is 2905x3). So that makes a total of 2905 files to be written. </p>
  
  <pre><code>for s =1:z(1)
      r= a(s,3);
  
      ang=0:0.1:2*pi; 
      xp=a(s,1) + r*cos(ang);  
      yp=a(s,2) + r*sin(ang);  
      xp=xp';
      yp= yp';
      cloud = [xp,yp]
  
      filename = ['Shower_Cloud',s,'number.txt']
      file_id = fopen (filename,'w');
      fprintf(file_id,'%g\t',cloud[]);
      fclose(file_id);
  end
  </code></pre>
  
  <p>The error when i run the code is the main problem i'm not able to diagnose this problem on my own, although i have a feeling its a minor one.</p>
  
  <pre><code>     &gt;&gt; xyz
       D:\Users\Vikram\Documents\MATLAB\Manuela\Version_2\Weather\Shower\xyz.m:
       Too many files open; check that FILES = 20 in
       your CONFIG.SYS file.
  
       Unexpected error status flag encountered.  Resetting to proper state.
  </code></pre>
  
  <p>Please ask if i missed on something important to mention.</p>