We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 6058be6 commit fbad80aCopy full SHA for fbad80a
code/matlab_py/mat2py.m
@@ -100,8 +100,26 @@
100
end
101
case 'cell'
102
x_py = py.list();
103
- for i = 1:numel(x_mat)
104
- x_py.append(mat2py(x_mat{i}, char_to));
+ dims = size(x_mat);
+ if prod(dims) == max(size(x_mat))
105
+ % 1D cell array
106
+ for i = 1:numel(x_mat)
107
+ x_py.append(mat2py(x_mat{i}, char_to));
108
+ end
109
+ else
110
+ if length(dims) > 2
111
+ fprintf('mat2py: %d-dimensional cell array conversion ' + ...
112
+ 'is not implemented\n', length(dims));
113
+ return
114
115
+ nR = dims(1,1); nC = dims(1,2);
116
+ for r = 1:nR
117
+ this_row = py.list();
118
+ for c = 1:nC
119
+ this_row.append(mat2py(x_mat{r,c}, char_to));
120
121
+ x_py.append(this_row);
122
123
124
case 'struct'
125
x_py = py.dict();
0 commit comments