title: How to load *.mat file and convert it to numpy array?
body: <p>As in the subject, ie. how to load given <code>*.mat</code> file and convert it to numpy array? Say, I've got a matlab matrix:</p>
  
  <pre><code>X =
  
       8     1     6
       3     5     7
       4     9     2
  </code></pre>
  
  <p>I saved it as <code>data.mat</code>, and now I want to load it in my python script, where next I want to convert it to numpy array, so it will become:</p>
  
  <pre><code>np.array([[8, 1, 6], [3, 5, 7], [4, 9, 2]])
  </code></pre>
  
  <p>I know already, that I can use the <code>scipy.io.loadmat()</code> function, but when I try to call it just like that:</p>
  
  <pre><code>mat = scipy.io.loadmat('data')
  </code></pre>
  
  <p>...I'm getting an error:</p>
  
  <pre><code>Traceback (most recent call last):
    File "C:/Users/jsmith/PycharmProjects/MagicScript.py", line 4, in &lt;module&gt;
      mat = si.loadmat('data')
    File "C:\Users\jsmith\Anaconda3\lib\site-packages\scipy\io\matlab\mio.py", line 131, in loadmat
      MR = mat_reader_factory(file_name, appendmat, **kwargs)
    File "C:\Users\jsmith\Anaconda3\lib\site-packages\scipy\io\matlab\mio.py", line 55, in mat_reader_factory
      mjv, mnv = get_matfile_version(byte_stream)
    File "C:\Users\jsmith\Anaconda3\lib\site-packages\scipy\io\matlab\miobase.py", line 237, in get_matfile_version
      % ret)
  ValueError: Unknown mat file type, version 46, 51
  </code></pre>
  
  <p>Thank you in advance.</p>