Skip to content

Commit 32c5bbd

Browse files
committed
support array of structs
1 parent fa4da51 commit 32c5bbd

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

code/matlab_py/mat2py.m

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,13 @@
105105
x_py = py.dict();
106106
F = fieldnames(x_mat);
107107
for i = 1:length(F)
108-
x_py.update(pyargs(F{i}, mat2py(x_mat.(F{i}))));
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))));
113+
end
114+
end
109115
end
110116
otherwise
111117
fprintf('mat2py: %s conversion is not implemented\n', class(x_mat))

0 commit comments

Comments
 (0)