title: savetxt & close file + python + numpy
body: <p>I was wondering if anyone could help me with one problem that I have when using the python + numpy function 'savetxt'.</p>
  
  <p>The problem is: </p>
  
  <p>(1) I have a subroutine in which I save a matrix (numerical data) into a textfile (using the function savetxt): </p>
  
  <p>For example:</p>
  
  <pre><code>import numpy as np
  A = np.matrix('1 2; 3 4')
  np.savetxt('myfile.txt', A, fmt='%-7.8f', delimiter=',')
  </code></pre>
  
  <p>(2) Then, I have to use that data in another program. It is a time-domain simulation and I need to read the data at each iteration. I observe the following:</p>
  
  <ul>
  <li><p>Reading the data from the file that I have created makes the process much more slower.</p></li>
  <li><p>The curious thing is that, if I use the same data (without saving it before with my subroutine), the program goes fast. For example, if I save the data, it goes slow, but if I restart the computer, it goes fast.</p></li>
  </ul>
  
  <p>Perhaps the file is not closed when I use it later. </p>
  
  <p>I would be very grateful if someone can give me some clues about possible causes of this problem.</p>
  
  <p>Thank you very much.</p>
  
  <p>Javier</p>