title: Create Matlab struct in Python
body: <p>I have a problem: I want to create a Matlab like struct in Python. The struct I need to create has two fields: "val" and "sl". It has to be a 1x2 struct. The "val" field needs to have two 3x3 matrices inside (e.g A and B), while the "sl" field needs to have two values inside (e.g 137 and 159). 
  The final struct should be like this:</p>
  
  <pre><code>val    sl
  3x3   137
  3x3   159
  </code></pre>
  
  <p>In Matlab the code is: <code>struct(1).val=A;struct(1).sl=137;struct(2).val=B;struct(2).sl=159</code>
  In python I've tried <code>hval = fromarrays([[A, B], [137, 159]], names=['val', 'sl'])</code> but it gives me this error: File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/numpy/core/records.py", line 608, in fromarrays
      raise ValueError("array-shape mismatch in array %d" % k)</p>
  
  <p>ValueError: array-shape mismatch in array 1
  Does anyone know how to solve this problem?</p>