title: Convert multiple Python dictionaries to MATLAB structure array with scipy.io savemat
body: <p>A simple question, but one I can't seem to be able to wrap my head around. I'm using the <code>scipy.io</code> library to save Python dictionaries as a Matlab structs. Now, the <a href="https://docs.scipy.org/doc/scipy-0.18.1/reference/tutorial/io.html#matlab-structs" rel="nofollow noreferrer">documentation</a> of the <code>scipy.io</code> library shows us how to do this for a single Python Dictionary to a single Matlab Struct:</p>
  
  <pre><code>&gt;&gt;&gt; a_dict = {'field1': 0.5, 'field2': 'a string'}
  &gt;&gt;&gt; sio.savemat('saved_struct.mat', {'a_dict': a_dict})
  </code></pre>
  
  <p>This sounds fair enough, and works: </p>
  
  <p><a href="https://i.stack.imgur.com/Jkt81.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Jkt81.png" alt="enter image description here"></a></p>
  
  <p>However, I now want to do the same for multiple Python Dictionaries. I want them to be translated to a Matlab struct in which the column names are equal to the keys of all the dictionaries (which are obviously all the same keys names) and I want each row to represent the values for those keys for one of the Dictionaries. If I see this correctly, this is called a 1 x K struct with 10 fields, with K being the amount of rows (Python Dictionaries) I want to map. fields An example shown below: </p>
  
  <p><a href="https://i.stack.imgur.com/yIb3X.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/yIb3X.png" alt="enter image description here"></a></p>
  
  <p>Although I myself am totally unaware of correct Matlab terminology, a good soul in the comments told me this is supposed to be called a <em>structure array</em>. I have tried simply creating a numpy array of Python dictionaries, putting that in the <code>a_dict</code> key value pair of the code example above and saving that, but with no succes. Doing that results in a list of all different structs, instead of the one big struct with the rows representing the values for every individual struct. </p>
  
  <p>As such, I am still in search of an appropriate solution for this problem. If you need any additional details, feel free to ask in the comments. Thanks for helping!</p>