title: Read Matlab Data File into Python, Need to Export to CSV
body: <p>I have read a Matlab file containing a large amount of arrays as a dataset into Python storing the Matlab Dictionary under the variable name <code>mat</code> using the command:</p>
  
  <p><code>mat = loadmat('Sample Matlab Extract.mat')</code></p>
  
  <p>Is there a way I can then use Python's write to csv functionality to save this Matlab dictionary variable I read into Python as a comma separated file? </p>
  
  <pre><code>with open('mycsvfile.csv','wb') as f:
     w = csv.writer(f)
     w.writerows(mat.items())
     f.close()
  </code></pre>
  
  <p>creates a CSV file with one column containing array names within the dictionary and then another column containing the first element of each corresponding array.  Is there a way to utilize a command similar to this to obtain all corresponding elements within the arrays inside of the 'mat' dictionary variable?</p>