File tree Expand file tree Collapse file tree 1 file changed +19
-6
lines changed Expand file tree Collapse file tree 1 file changed +19
-6
lines changed Original file line number Diff line number Diff line change 104104 case ' struct'
105105 x_py = py .dict();
106106 F = fieldnames(x_mat );
107- for i = 1 : length(F )
108- if length(x_mat ) == 1
109- x_py .update(pyargs(F{i }, mat2py(x_mat.(F{i }))));
110- else
111- for j = 1 : length(x_mat )
112- x_py .update(pyargs(F{i }, mat2py(x_mat(j ))));
107+ if (length(x_mat ) > 1 ) && ...
108+ (class(x_mat ) == " struct" )
109+ % struct array
110+ x_py = py .list();
111+ for j = 1 : length(x_mat )
112+ x_py .append( mat2py(x_mat(j )) );
113+ end
114+ else
115+ for i = 1 : length(F )
116+ if (length(x_mat.(F{i })) > 1 ) && ...
117+ (class(x_mat.(F{i })) == " struct" )
118+ % struct of struct array
119+ List = py .list();
120+ for j = 1 : length(x_mat.(F{i }))
121+ List .append( mat2py(x_mat.(F{i })(j )) );
122+ end
123+ x_py .update(pyargs(F{i }, List ));
124+ else
125+ x_py .update(pyargs(F{i }, mat2py(x_mat.(F{i }))));
113126 end
114127 end
115128 end
You can’t perform that action at this time.
0 commit comments