Convert Python dict files into MATLAB struct
<p>I have a function in Python that outputs a dict. I run this function into MATLAB and save the output to a parameter (say <code>tmp</code>) which is a dict of nested other dicts itself. Now I want to convert this file into a useful format such as structure.</p>

<p>To elaborate: <code>tmp</code> is a dict. <code>data = struct(tmp)</code> is a structure but the fields are other dicts. I tried to go through every field and convert it individually, but this is not very efficient. </p>

<p>Another option: I have the output saved in a JSON file and can load it into MATLAB. However, it is still not useable. </p>

<p>So python -> MATLAB is a bit tricky with dictionaries/structs because the type of object that MATLAB is expecting is a dictionary object where each key is a single variable you want from python as a simple data type (array,int, etc).  It doesn't like having nested dictionaries.  </p>

<p>I recommend 
1: Store each dictionary separately instead of as part of a higher level object.<br>
or 2: even though it is not very nice converting the structs to individual variables.</p>

<p>MATLAB should be able to handle simple non-nested structures like that.</p>

python matlab dictionary struct